According to Paul the Deacon, author in the 8th century of the Historia Langobardorum, Theodolinda is responsible for the foundation of the church, at a date that should be around 595-600.
In this regard, the legend transmitted by the fourteenth-century chronicler Bonincontro Morigia envelops in a miraculous aura the initiative of the Queen: stop to rest while participating in a hunting trip on the banks of the Lambro, Theodolinda would have had the vision of the dove of the Holy Spirit, who would whisper the word “Way” (“here”), to which the Queen would respond by exclaiming “Etiam” (“yes”).
Precisely at that point she would then build a palace and an oraculum, that is a chapel dedicated to Saint John the Baptist, incunabolo of the next basilica, while from the fusion of the two words uttered would arise the toponym Modoetia, the ancient name of Monza.
Used as a chapel palatine and intended to receive the remains of king Agilulfo, son Adaloaldo and the same Teodolinda, the church went through alternate events during the Middle Ages: fallen at the end of the Lombard kingdom, It flourished again in the Carolingian age – thanks mainly to the protection of the emperor Berengar, who at the beginning of the 10th century gave her precious furnishings, expanding the already rich endowment of the Treasury established by Agilulf and Theodolinda – and then increased its properties, Until he obtained the dominion over the village, which he exercised between the X and the XII century with the support of both the emperors of Germany, interested in making it a center of their power in Italy, and the popes, who granted him autonomy from Milan.