The town has been founded during the Early Middle Ages by the Longobards, as a small village defended by a fortified enclosure. This area is called Castle of Ghedi, in which arose the ancient Early Christian church, some small shacks and, since the High Middle Ages, the town hall. During the 14th century, the construction of structures outside the walls began and were formed four suburbs: Bazzina, Gazzolo, Borgonuovo and Malborgo.
Due to the development of increasingly powerful weapons, during the 16th century, Ghedi and its castle lost their strategic importance, and the town began to decline. During the 18th century, Palazzo Orsini, in state of decay, collapsed; its access portal was bought by the Victoria and Albert Museum of London, where it is still located. In the same century, the Niccolò Orsini's funeral monument was bought by Santa Giulia Museum, where it is still located.
During the 20th century, Ghedi experienced economic growth, favored by construction of the Train Station (1893) and of the Ghedi Air Base (1909). In this period, the Cotonificio del Mella cotton mill opened with around 500 workers and became the largest factory in the town.[7]