The Gymnasium has its origin in the cathedral- and monastery schools established by the Roman Catholic Church in the early Middle Ages, and seven of the schools established in the 12th and 13th centuries still exist today. The medieval schools had, broadly speaking, only one purpose: to educate the servants of the Catholic Church by teaching them to read, write, and speak Latin and Greek. Following the Reformation's official implementation in 1536, the schools were taken over by the Crown; their primary purpose remained preparing students for theological studies, only now it was for the benefit of the Protestant Church.
This educational base remained nearly unchanged until 1809, when the old Clergyman's School was transformed, in accordance with the spirit of the time, into a humanistic Civil Servant's School, the purpose of which was to "foster true humanity" through immersion in the ancient Greek and Latin cultures combined with some teaching of natural science and modern languages.
In 1871, the scientific and technical development of the 19th century led to a division of the education curriculum into two lines: the languages and the mathematics-science line. This division remained the backbone of the structure of the Gymnasium until the year 2005, when a major reform of the Gymnasium was enacted. Today, each Gymnasium offers a selection of lines decided by each individual Gymnasium. These typically include various linguistic, scientific, and creative lines, as well as combined-subject lines.
In 1903, the languages line was divided into a classical line, preserving extensive teaching in Latin and Greek, and a modern languages line, in which Latin and Greek were replaced by English, German, and French. At the same time, the three-year course of the Gymnasium was directly connected with the municipal school through the establishment of the mellemskole ("middle school", grades 6-9), later to be replaced by the realskole.
According to the latest reform, the Gymnasium still offers three years of general upper secondary education in two lines. The division of the two lines into three branches each has however been replaced by a more flexible system, under which each of the lines contains a core curriculum of obligatory subjects and a number of optional subjects which can be taken at two levels.