It began as the tomb that Emperor Hadrian had built for himself and his family between 134 and 139 AD, was later turned by the popes into a fortress, residence and prison, and has housed the Museo Nazionale di Castel Sant'Angelo since its decommissioning in 1901. Its Italian name means "Castle of the Holy Angel".

The mausoleum was first a decorated cylinder with a garden on top and a golden four-horse chariot. Hadrian's ashes were laid here a year after he died at Baiae in 138, alongside the remains of Sabina, his wife, and of Lucius Aelius, his adopted son, and later emperors followed, the last recorded being Caracalla in 217. The urns probably stood in what is now called the Treasury Room, deep inside the building. Most of what decorated the tomb has gone: it became a military stronghold in 401 and part of the Aurelian Walls, Alaric's Visigoths scattered the urns in 410, and when the Goths besieged Rome in 537 the defenders hurled the bronze and stone statues down on the attackers.

The castle owes its name to a legend: in 590 the Archangel Michael was seen on top of the mausoleum, sheathing his sword to mark the end of a plague. From the 14th century the popes turned the building into a castle, and Pope Nicholas III linked it to St Peter's Basilica with the Passetto di Borgo, a covered and fortified passage. During the Sack of Rome in 1527, Pope Clement VII sheltered here from the troops of Charles V. Leo X added a chapel, and Paul III had a lavish apartment fitted out so that a besieged pope would have suitable rooms.

The Papal State also kept prisoners in the castle: Giordano Bruno spent six years here, while Cagliostro and the goldsmith-sculptor Benvenuto Cellini were among the other inmates. Executions took place in the small inner courtyard. The prison inspired the setting of the third act of Puccini's opera Tosca, which ends with the heroine throwing herself from the ramparts.

Inside, visitors can see the marble statue of Saint Michael that Raffaello da Montelupo carved in 1536 for the top of the castle; it now stands in an open court within the building. In 1753 it was replaced on the summit by the bronze version that is there today, the work of the Flemish artist Peter Anton von Verschaffelt. Hadrian also built the Pons Aelius leading straight to his tomb, and the bridge still makes the approach from the centre of Rome and the left bank, lined with Baroque statues of angels carrying the instruments of Christ's Passion.