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.
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.
The town of San Gimignano has many fine examples of Romanesque and Gothic architecture. As well as churches and medieval fortifications, there are notable examples of Romanesque secular and domestic architecture which may be distinguished from each other by their round and pointed arches, respectively. A particular feature which is typical of the region of Siena is that the arches of openings are depressed, with doorways often having a second low arch set beneath a semi-circular or pointed arch. Both Romanesque and Gothic windows sometimes have a bifurcate form, with two openings divided by a stone mullion under a single arch.
This Piazza, entered from Via San Giovanni, is the main square of the town. It is triangular in shape and is surrounded by medieval houses of different dates, among them some fine examples of Romanesque and Gothic palazzos. At the centre of the piazza stands a well which was the main source of water for the town's residents. The structure dates from 1346. Although much of it has been renewed in the late 20th century, parts of the paving date from the 13th century.
This piazza is to the north of Piazza della Cistern and is connected by a passage adjacent to an open loggia. To the west, at the top of the square, stands the Collegiate Church, reached by a broad flight of steps. The name of the square would seem to imply that this church was at one time a cathedral, but although it was perhaps planned, this was not the case. Other important buildings on the square include the Palazzo Comunale and the Palazzo Podesta, the house of the mayor. The Palazzo Podesta is distinguished by its huge arched loggia.
While in other cities, such as Florence, most or all of their towers have been brought down due to wars, catastrophes, or urban renewal, San Gimignano has managed to conserve fourteen towers of varying heights, for which it is known internationally.
There are many churches in the town: the two main ones are the Collegiata, formerly a cathedral, and Sant'Agostino, housing many artworks from early Italian renaissance artists.
The Communal Palace, once seat of the podestà, is currently home of the town gallery, with works by Pinturicchio, Benozzo Gozzoli, Filippino Lippi, Domenico di Michelino, Pier Francesco Fiorentino and others. From Dante's Hall in the palace, access may be made to a Maesta fresco by Lippo Memmi, as well as the Torre del Podestà or Torre Grossa, 1311, which stands 54 metres (177 ft) high.
San Gimignano is the birthplace of the poet Folgore da San Gimignano (1270–1332).
A fictionalised version of San Gimignano is featured in E. M. Forster's 1905 novel, Where Angels Fear to Tread as Monteriano.
Tea with Mussolini, a 1999 drama about the plight of English and American expatriate women in Italy during World War II, was filmed in part in San Gimignano. The frescoes that the women save from being destroyed during the German Army's withdrawal are inside the Duomo, the town's main church.
Franco Zeffirelli used San Gimignano as a stand-in for the town of Assisi in his 1972 Saint Francis of Assisi biopic Brother Sun, Sister Moon. Most of the "Assisi" scenes were filmed here.
In the novel The Broker by John Grisham, Joel Backman takes his second of three wives on vacation in Italy to keep her from divorcing him. They rent a 14th-century monastery near San Gimignano for a month.
M. C. Escher's 1923 woodcut, San Gimignano, depicts the celebrated towers.
A 15th-century version of the town is featured in the 2009 video game Assassin's Creed II.