So there are a couple of ways we can go about looking at this question- the first is when is Islam first recorded having actually entered China at all. The second might be when did the official Chinese records actually sit up and start taking notice. Let’s see if we can deal with both in turn…
Islam is first recorded entering into China from Sino-Tibetan Islamic sources themselves as stemming from the embassy of Sa’d ibn ali Waqqas, the maternal uncle of the Prophet Muhammad himself. From the Leslie translation of the Zhengjiao si bei ji by Ting Peng,
How the Muslims Came to China
Muhammad had the power to create Heaven and Earth. […] He divided the moon into two and put it together again. […] This was in 621, 4th year of Wude [Era]. In imperial order was thereupon given to ouyang Xun, a keeper of the clepsydra to engrave in seal characters coins for the Commencement of the (Islamic?) Era, in order to record the extraordinary feat. After this, [Emperor] Taizong dreamt that he met a saint and waking up frightened he then sent several missions to the (saint’s) land. The saint then ordered his disciple Saad Waqqas to bring the Qur’an in 30 volumes comprising 114 sura and 6,666 verses to offer the emperor. […] Taizong edited it and promulgated it throughout the empire, and the faith flourished in China.
This is echoed the 18th c. Sino-Muslim Origin of the Muslims (Huihui yuanlai), also translated by Leslie:
The Tang emperor (Taizong) dreamt that a turbanned man chasing a phantom appeared to him in the palace. […] The Interpreter of Dreams said: “The turbaned man is a Hui-hui (Muslim) of the west. In Arabia is a Muslim king of great virtue. A great sage is born, with favorable omens.” A general Xu Shiji stepped forward and said: “Send an ambassador across the western frontiers to the Muslim king, and request from him a sage to be sent to deal with the threatened evils, so that the country may be kept at rest.” The great officer Shi Tang was sent as ambassador. Three religious leaders were sent back to China with him. […] Two died on the way, only Gexin [Waqqas] arrived. Gexin told the emperor of the heaven-sent Fuergeni [Arabic: furqan, sacred scriptures (Old Testament, New Testament, & Qur’an)], and reproved him for being an idolator. The emperor finally offered to appoint Gexin as President of the Board of Mathematics.
Those are nice stories and everything… but there’s no historical evidence that Sa’ad Waqqas actually ever travelled to China. And it’s absolutely ludicrous to think that Taizong would have put of with some religious mystic from abroad coming before him a reproving him as an idolator. That's the kind of kookery that lost people their heads in Tang China. And no 7th century ambassador was ever listed as the President of the Board of Mathematics… that wouldn’t occur until the Mongol Yuan Dynasty of the 13th century.
Nevertheless, the timeline itself is probably pretty close. Lipman says it’s “likely that Muslims did come to China as political emissaries and merchants within a few decades of Muhammad’s flight from Mecca to Medina in 622.” For the following 600 years, it would be overwhelmingly Muslim traders that interacted directly with China economically via the Silk Road and the Indian Ocean trade routes. Primarily these would be as “tribute” missions in which “dozens of cravans arriving in Chang’an and Kaifeng, where they received free lodging, luxurious entertainment, and benevolent gifts usually reported as exceeding in value the “tribute” they had brought,” and after a few months they’re depart back West, tidy profits well in-hand. Others, however, would opt to stay in China for the long haul. Though they were legally and physically segregated from the larger society, by the 9th century upwards of 150,000-200,000 Muslims, Jews, Christians, and other foreigners were living in the southern port of Guangzhou immediately prior to the massacre of 878, according to the accounts of Abu Zayd Hasan As-Sirafi. Nevertheless, Chinese sources still barely officially acknowledge their presence, and they only ever bothered counting them at all for the purposes of taxation.
Sources:
Leslie, Donald. 1986. Islam in traditional China: A short history to 1800.
Lipman, Jonathan N. 1998. Familiar Strangers: A History of Muslims in Northwest China.
Renaut, Eusebius (tr.). 1733. Ancient Accounts of India and China by Two Mohammedan Travellers: who went to those Parts in the 9th Century.