The first records of the Basilica of Santa Maria in Cosmedin date back to the 6th century, when it held the title of deaconry and was called Sancta Maria in Schola Graeca, a name due to the large presence of a Greek community in that area. Built on the Ara Maxima of Hercules Invincible, an altar dedicated to the mythical hero by the Latin king Evander, the church was enlarged in 782 at the behest of Pope Hadrian I and entrusted to the Greeks who had come to Rome fleeing the East because of iconoclasm. The basilica underwent modifications and renovations over time, still preserving precious works today, including the Cosmatesque-style floor and the Gothic ciborium created by Deodato di Cosma. In the upper part of the walls of the central nave, the remains of frescoes dating back to 1123 are visible: the right wall features episodes from the Book of Daniel, while the left wall features scenes from the Book of Ezekiel. The term Cosmedin derives from Greek and has been associated with the church to indicate its precious decorations.
The basilica's crypt was excavated from the tuff block base of the podium of the Temple of Hercules.
The sacristy of Santa Maria in Cosmedin houses a small mosaic fragment of the Adoration of the Magi from the oratory of John VII (705-707), part of the complex of the ancient Basilica of St. Peter in the Vatican, transferred to the basilica in 1639 at the behest of Urban VIII.
The complex was renovated several times until it assumed its Romanesque appearance in the 12th century. The portico and the elegant Romanesque bell tower, 34.20 meters high and featuring a bell from 1289, are the work of Alfano Camerario, a very powerful administrator of papal assets.
The Basilica of Santa Maria in Cosmedin is renowned for its so-called Mouth of Truth (Bocca della Verità ), an ancient marble mask depicting a bearded male face with an open mouth; its eyes, nose, and mouth are hollow and pierced. Placed in the church's portico since 1632, in ancient Rome the Mouth of Truth was a manhole cover used to drain rainwater; these masks were placed horizontally to decorate the lowest points of squares or streets. What is certain is that the mask already enjoyed legendary fame in the Middle Ages, when the legend spread that Virgil Grammaticus, a sixth-century scholar with a reputation as a magician, built the Mouth of Truth for the use of husbands and wives who doubted their spouse's fidelity. The mouth would cut off the hand of anyone who told a lie.