Ziryabs career flourished in Al-Andalus. According to the Encyclopaedia of Islam, he was born around 175 AH/790 into a family of mawali' of the caliph al-Mahdi. His ethnic origin is unclear. Based on his appearance and background, different sources suggest him to be a Persian, Kurdish, Arab, Sindi or African. According to Ibn Hayyan, ‘Ali Ibn Nafi’ was called Blackbird because of his extremely dark complexion, the clarity of his voice and “the sweetness of his character.”
As the Islamic armies conquered more and more territories, their musical culture spread with them, as far as western China in the east and Iberia in the west. After their 8th-century conquest of nearly all of Hispania, which they renamed Al-Andalus, the Muslims were a small minority for quite some time, greatly outnumbered by the majority Christians and a smaller community of Jews, who had their own styles of music. With their arrival, the Muslims and Arabs introduced new styles of music, and the main cities of Iberia soon became well-known centers for music within the Islamic world. During the 8th and 9th centuries, many musicians and artists from across the Islamic world flocked to Iberia. While many were talented, Ziryab surpassed them all.
Ziryab was most likely born in Baghdad and was trained in the art of music from a young age. During that time, Baghdad was an important center of music in the Muslim world. The sources all agree that the accomplished and talented musician Ibrahim al-Mawsili was Ziryab's teacher. There is some debate about how he arrived in al-Andalus, but he may have offended his patron or some powerful figure with his musical talent.
One account recorded by al-Maqqari says that Ziryab inspired the jealousy of his mentor by giving an impressive performance for the caliph Harun al-Rashid (d. 809), with the result that al-Mawsili told him to leave the city. Earlier, more reliable sources indicate that he outlived both Harun and his son al-Amin and left after al-Amin's death in 813.
Ziryab left Baghdad during the reign of al-Mamun some time after the year 813. He then traveled first to Syria and then Ifriqiya (Tunisia) in Kairouan, where he lived at the Aghlabid court of Ziyadat Allah (ruled 816–837). Ziryab fell out with Ziyadat Allah but was invited to Al-Andalus by the Umayyad prince, Al-Hakam I (ruled 796–822). He found on arrival in 822 that the prince had died, but the princes son, Abd ar-Rahman II, renewed his fathers invitation. Ziryab settled in Córdoba with a monthly salary of 200 gold Dinars, and he soon became celebrated as the courts aficionado of food, fashion, singing, and music. He introduced standards of excellence in all these fields as well as setting new norms for elegant and noble manners. He was an intimate companion of the prince and established a school of music that trained singers and musicians and which influenced musical performance for at least two generations after him.
Al-Maqqari states in his Nafh al-Tib (Fragrant Breeze): "There never was, either before or after him (Ziryab), a man of his profession who was more generally beloved and admired".