Al-Madinah (Arabic for the city) was so called as it received Prophet Muhammad (peace and blessings be upon him) when he migrate from Makkah on Allah swt command in 622 CE.
It is also known by the name Taibah derived from the Arabic word meaning kindness. Another name it goes by is Dar Al-Hijra (Arabic for Land of Migration) because it is where the Prophet (peace and blessings be upon him) had migrated to.
The tribes of Banu Matraweel and Banu Hauf were the first settlers to inhabit and cultivate the oasis of Madinah. Both tribes descended from the lineage of Shem, the son of Prophet Noah (peace be upon him). Many years later, the Yemeni tribes of Banu Aus and Banu Khazraj arrived at Madinah.
In 622 CE, when Prophet Muhammad (peace and blessings be upon him) immigrated to Madinah he introduced the Madinah Charter, which is in fact the first ever written constitution in the history of humankind.
The charter regulated relations between the Muslims and Jews who lived there. It gave both parties the rights of protection, security, and justice.
Madinah was the center and capital of the Islamic Empire during the time of Prophet Muhammad (peace and blessings be upon him) and the first Five Righteous Caliphs after him. With the beginning of the Umayyad rule, the Islamic state was transferred to Damascus.