The name of this village says which side it was on. In 1296 the landowners of the area asked Bologna to build a stronghold, because Imola, which was ghibelline and a step away, kept attacking; in 1309 the comune of Bologna gave full powers to the architect Romeo Pepoli, and the Castrum Guelfum was born, the guelph castle, from which Castel Guelfo. The fourteenth-century walls still close the small old centre, with four round corner towers and the Cassero, which was once the only gate and which, between the eighteenth and nineteenth centuries, having lost every military use, was made handsome. The territory then passed to Ludovico Alidosi of Imola, who held it from 1404 to 1424, and later pope Pius II gave it over to the Malvezzi and raised it to a county: their palace, wanted by Virgilio Malvezzi in 1448, with its pointed portal and the two Renaissance loggias in the courtyard, is today the town hall.
On the evening of 28 January 1850 the band of the Passatore came to the village. It was coming from a robbery at a farmhouse in the Imola countryside; having entered Castel Guelfo, it killed two Papal Velites and tried to strip the house of a landowner, holding some thirty inhabitants hostage. The job failed: the brigands got drunk and went away. The things the village has kept far longer are others: the brazadela, the ring-shaped cake made here for more than seven hundred years, which has its fair at the end of June together with the wine; and the wooden Crucifix, carved, gilded and painted, before which the people of Castel Guelfo have gathered since the Middle Ages and for which, every five years, the Festa bella is held, with the village lit up and the evening procession. There is also a race called the Mile in the Limes: it is run all straight along an avenue of two hundred and twenty-four lime trees, exactly a mile long.