In the German-speaking, the Central-European, the Nordic, the Benelux (Netherlands, Belgium, Luxembourg) and the Baltic countries, this meaning for "gymnasium", that is a secondary school preparing the student for higher education at a university, has been the same at least since the Protestant Reformation in the 16th century.
This use of the term did not prevail among the Romans, but was revived during the Renaissance in Italy, and from there passed into the Netherlands and Germany during the 15th century.