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.
The city flourished until 1348, when it was struck by the Black Death that affected all of Europe, and about half the townsfolk died. The town submitted to the rule of Florence. Initially, some Gothic palazzi were built in the Florentine style, and many of the towers were reduced to the height of the houses. There was little subsequent development, and San Gimignano remained preserved in its medieval state until the 19th century, when its status as a touristic and artistic resort began to be recognised.
The city is on the ridge of a hill with its main axis being north/south. It is encircled by three walls and has at its highest point, to the west, the ruins of a fortress dismantled in the 16th century. There are eight entrances into the city, set into the second wall, which dates from the 12th and 13th centuries. The main gates are Porta San Giovanni on the ridge extending south, Porta San Matteo to the north west and Porta S. Jacopo to the north east. The main streets are Via San Matteo and Via San Giovanni, which cross the city from north to south. At the heart of the town are four squares: the Piazza Duomo, on which stands the Collegiate Church; the Piazza della Cisterna, the Piazza Pecori and the Piazza delle Erbe. To the north of the town is another significant square, Piazza Agostino, on which stands the Church of Sant' Agostino. The locations of the Collegiate Church and Sant' Agostino's and their piazzas effectively divide the town into two regions.