In the 3rd century BC a small Etruscan village stood on the site of San Gimignano. Chroniclers Lupi, Coppi and Pecori relate that during the Catiline conspiracy against the Roman Republic in the 1st century, two patrician brothers, Muzio and Silvio, fled Rome for Valdelsa and built two castles, Mucchio and Silvia (now San Gimignano). The name of Silvia was changed to San Gimignano in 450 AD after Bishop Geminianus, the Saint of Modena, intervened to spare the castle from destruction by the followers of Attila the Hun. As a result, a church was dedicated to the saint, and in the 6th and 7th centuries a walled village grew up around it, subsequently called the "Castle of San Gimignano" or Castle of the Forest because of the extensive woodland surrounding it. From 929 the town was ruled by the bishops of Volterra.
In the Middle Ages and the Renaissance era, it was a stopping point for Catholic pilgrims on their way to Rome and the Vatican, as it sits on the medieval Via Francigena. The city's development was also improved by the trade of agricultural products from the fertile neighbouring hills, in particular saffron, used in both cooking and dyeing cloth and Vernaccia wine, said to inspire popes and poets.
In 1199, the city made itself independent of the bishops of Volterra and established a podestà, and set about enriching the commune with churches and public buildings. However, the peace of the town was disturbed for the next two centuries by conflict between the Guelphs and the Ghibellines, and family rivalries within San Gimignano. This resulted in competing families building tower houses of increasingly higher and higher heights. Towards the end of the Medieval period, there were 72 tower houses in number, up to 70 metres (230 feet) tall. The rivalry was finally restrained when the local council ordained that no tower was to be taller than that adjacent to the Palazzo Comunale.
While the official patron is Saint Geminianus, the town also honours Saint Fina, known also as Seraphina and Serafina, who was born in San Gimignano 1238 and whose feast day is 12 March. The Chapel of Santa Fina in the Collegiate Church houses her shrine and frescos by Ghirlandaio. The house said to be her home still stands in the town.
On 8 May 1300, San Gimignano hosted Dante Alighieri in his role as ambassador of the Guelph League in Tuscany.