The origins of Gaeta’s name are still shrouded in legend: Strabo indicated its origin from the term "Caiatas" used by Laconian fishermen to refer to the site, with clear reference to the wide inlet of its gulf;
Diodorus Siculus connected these lands to the myth of the Argonauts by deriving the name of the city from "Aietes," mythical father of Medea (daughter of Circe), the sorceress in love with Jason.
Virgil, in the "Aeneid" (Aeneid, VII, 1-4) found its origin in the name of Aeneas’s nurse, "Cajeta," buried by the Trojan hero at that site during his journey to the Latian coast.
Dante, as if to signify the historicity of the Aeneid, confirmed the event
(Inferno, XXVI, 92).
The first settlements in Gaeta’s territory date back to the eighth century B.C., but it was not until 345 B.C. that it came under the influence of Rome.
During the Roman period Gaeta became a popular resort frequented by emperors, wealthy Roman patricians, consuls and famous senators of the time. A new Roman road, the Via Flacca, shorter than the Appian Way, was even built to facilitate their coming.
With the decline of the Western Roman Empire a dark period of transition began, characterized by continuous looting by first barbarian populations and then Saracens.
Precisely because of its characteristic position on a natural peninsula, easily defensible, it slowly became a "castrum": Gaeta was fortified with city walls and on the slopes of Mount Orlando; on the high area of the ancient medieval village arose the castle of Gaeta to defend the town, and the populations of the surrounding areas moved inside the walls to find hospitality, shelter and protection.
The first news of the castle dates back to the 6th century A.D. in the war against the Goths, in the 10th century it is mentioned within the "Codex" charters, but certain news of its existence comes in the 12th century, during the Swabian domination. In fact, Frederick II of Swabia came to Gaeta on several occasions and, during the struggles between the Guelphs and Ghibellines, created fortifications to better defend the borders of his kingdom: in 1223 he had those built for the castle of Gaeta (which therefore already existed at the time).
Under Spanish rule, which began in 1504, the role of "stronghold of the Kingdom of Naples" was even more pronounced, and the city was equipped with brand new bastioned fortifications, on the slopes of Mount Orlando upgraded against the latest and most powerful guns.
The city, historically part of the ancient province of Terra di Lavoro in Campania, was transferred to Lazio in the Fascist period, when it was incorporated into the nascent Province of Littoria (Latina)