The name Al-Qiblatayn means “The two prayer directions” and is associated with the well-known event when the direction of prayer was changed from Bayt Al-Maqdis in Jerusalem to Ka'bah in Makkah.
During the early period after the Prophet Muhammad ﷺ migrated to Madinah, Muslims prayed towards Jerusalem. The Prophet ﷺ looked towards the heavens, awaiting guidance from Allah, and wished for the direction of prayer to be towards the Sacred Mosque, Ka'bah.
Allah then revealed:
“We see you turning your face towards the heavens. We will surely turn you towards a direction of prayer that will please you. So turn your face towards the Sacred Mosque…”
(Qur’an 2:144)
This command came while the Prophet ﷺ was leading the prayer with his companions. They had begun the prayer facing Jerusalem. When the command regarding the new Qibla came, the Prophet ﷺ turned then towards the Ka'bah, and his companions followed him.