Today the building is known as the Kalenderhane Mosque, but it went through many phases as a Roman bath, a Byzantine church and a dervish lodge (tekke) before it became a mosque. The building itself in its present form stems from the middle Byzantine period. The original function as a bath with existing water connection is subtly evident in the fountain that was part of the later church and the soup kitchen during the Ottoman period.
Even the origin myth of the church (written around the 11th/12th century) is centered around water. The story goes that the poet Cyrus of Panopolis dedicated the church to Mary (Theotokos) on the spot where a man had been healed by sacred water.
The different phases of the building have been given modern names by Striker and Kuban: North Church, Bema Church, and Main Church (current form). During the Ottoman period, it became a complex, housing a dervish lodge and a medrese alongside the mosque (separate buildings).