Ancient greek grammar seems pretty complex to rebuild with the texts we have from that time; I was wondering if humanity re discovered ancient greek or if scholars, générations after generations, have transmitted it?
The short answer is that there is a transmission history of the knowledge of Ancient Greek. It was never 'lost' and reconstructed. Primarily this reception/transmission was through the ongoing existence of the Greek language through the Byzantine Empire. Even as the Greek language evolved towards Modern Greek, scholarly study maintained a strong classical focus.
In Europe a genuine knowledge and appreciation of Greek began to disappear in Late Antiquity, with Boethius in the early 6th century one of the last really competent scholars in Greek. You see a return of Greek studies under Renaissance Humanism, fuelled by the renewed interest in classical studies/philology that characterised RH, as well as a number of scholars from Constantinople spending time in Europe teaching and transmitting Greek. One of the first and foremost of these was Manuel Chrysoloras, who taught in Florence between 1396-1400 where, thanks to the groundwork laid by Salutati, he had a warm and earnest reception and following of humanists.
It's actually still taught in schools in Modern Greece it was never really lost and kids in Greece learn it from a very young age in school.