Imam Hasan al-Askari (peace be upon him) narrates about why Allah the High ordered the changing of the direction of prayers (the Qiblah) from Bait al-Maqdis in Jerusalem to the Holy Kaaba in Mecca.
In reply, Imam (peace be upon him) first quoted the verse of the Holy Quran which explains this very question,
And We did not make the Qiblah which you were upon (Bait al-Maqdis) except that We may know the one who follows the Prophet from those who turn back upon their feet. (Surah Baqarah 2: Verse 143)
Imam (peace be upon him) explained that the people of Mecca preferred to face the Holy Kaaba in their prayers and hence Allah ordered them to face Bait al-Maqdis in contravention to what they liked.
On the other hand, the people of Madinah preferred to face Bait al-Maqdis in their prayers and hence Allah ordered them to face the Holy Kaaba in contravention to what they preferred.
This was to differentiate between those who follow their desires and their preferences and those who follow the Prophet of Allah (peace be upon him and his holy progeny) regardless of their own likes and dislikes.
Thereafter, Imam (peace be upon him) quoted the verse of the Holy Quran,
And surely it was severe except upon those who were guided by Allah (Surah Baqarah 2: Verse 143)
Which refers to following the actions of the Holy Prophet (peace be upon him and his holy progeny) when he turned his face from Bait al-Maqdis towards the Holy Kaaba, which was severe upon those who preferred to follow their desires, as against those who followed the Holy Prophet (peace be upon him and his holy progeny) irrespective of their own desires.
References:
- Tafsir of Imam Hasan Askari (peace be upon him) p. 495, H. 311
- Al-Ehtejaaj, vol. 1, p. 42
- Al-Burhan fee Tafseer al-Quran, vol. 1, p. 339, H. 665
- Behaar al-Anwaar, vol. 4, p. 107, H. 18