The first nucleus of ancient “Anagni” dates back to the “Ernici”, a population which had to give way to the expansion of the Romans around 300 BC. The land on which Anagni is located, however, was already inhabited in prehistoric times, as shown by some fossils of "Homo Erectus" (the oldest in Italy), recently discovered in the valley.
Some important traces of the Roman city are the so-called “Arcazzi”, imposing travertine arches that open onto the northern side of the city walls. The monumental “Porta Cerere” (renovated several times) was the main access to Anagni, even at the time of the Ernici.
Origins of the name Anagni
As regards the etymology, there have been many interpretations over the centuries, but, overall, the comments seem to be shared by V. Apolloni, who writes:"
[...] The city has always had the same name 'Ananias', 'Anagni' (...) and the same position. As for the name and etymology, modern criticism does not consider at all the childish word combinations (...) and it seems that 'Anagni', absolutely an Italic name, has the same root as 'Anius' and 'Anio', i.e. the “Aniene” River [...]" [1].
Hence the name, as often happens, reflects the geography of the place (in this case the Aniene River).
Early history of Ernici - Anagni
The city of Ernici is more ancient than Rome, and Livy spoke of it several times. It was attacked by the Romans, and the Ernici fought with the Samnites to defend their freedom, but failed, and the Romans, led by Marzio (VI-V century BC), defeated and forced them to demand the peace.
Anagni later became a prefecture, and then a "municipium", and as such is mentioned by Cicero (106-43 BC) in his Oration “Pro domo sua”. After the fall of the Roman Empire in the early 5th century, Rome was captured and sacked by the Goths, and Anagni also suffered serious consequences, because it was also exposed to the pillage and slaughter.
In the mid-5th century, Geiseric (389-477), the king of Vandals, and Totila (died in 552), the king of the Goths attacked Rome, and these barbarians were followed, in the 8th century, by the Saracens, with their dangerous raids.
Anagni in the Middle Ages
The importance and fame of Anagni, however, is associated with its role in the 12th and 13th century, when it was the seat of many popes, who found a safe haven here. Four popes were native to Anagni i.e., Innocent III (1160-1216), Gregory IX (1170-1241), Alexander IV( 1185-1261) and the famous Boniface VIII (1230-1303).
In the early 14th century, the city suffered from the violence of Sciarra Colonna (1270-1329) and William of Nogaret (1260-1313) against Pope Boniface VIII, who had taken refuge within its walls. Conditions became much worse in the 15th century, when Ladislaus, king of Naples (1377-1414), aspired to the sovereignty of Rome and Italy.
There were more problems when the Duke of Alba (1507-1582), viceroy of Naples, invaded the Papal States because of disputes arising between Pope Paul IV and Philip II, the King of Spain and Sicily.
From the 17th century the city remained under the dominion of the Papal States, until the unification of Italy in 1861.
See also the Anagni travel and visitor guide.
References
1. See V. Apolloni, “History of Anagni”, 1889, Vol. I: 9-10