Dashi 大食, also written 大寔, was the Chinese name for the Arabs and the Muslims in Persia and Central Asia in general. The name first appears in sources of the Tang period 唐 (618-907) as Duoshi 多食 or 多氏. The word is derived from the designation of one particular Arabian tribe called Ṭayyi' or Tai that was in Middle Persian transformed into Tajik or Tāzī (the origin of the state name Tajikistan). Another explanation of the word Dashi is the Arabian word for merchant, tājir.
The Chinese and Turks (Tujue 突厥) used the word Dashi to designate all Central Asian muslims, regardless if they were Persians or Arabs. Even the great historian Maḥmūd al-Kāšġarī محمد الكاشغري from Kašgar says that the Täzīk were Persians. Likewise, the history Jiutangshu 舊唐書 mentions troops from Dashi that helped putting down the rebellion of An Lushan, and the Liaoshi 遼史 mentions a Khitan 契丹 princess being sent to Dashi. Both books certainly speak of Central Asia, and not of the Arabs.
Although mercantile contacts between China and the Arabs existed at an earlier point of time in a rather indirect form, the first direct encounter between Chinese and Arabians took place in 751 on the battlefield. The king of the statelet of Shi 石國 in the Soghdiana (modern Uzbekistan) asked the Arabs for support against the Tang empire 唐 (618-907). The Tang general Gao Xianzhi 高仙芝 led his troops against Ziyād ben Ṣāliḥ. near the city of Talas 怛邏斯 (modern Taraz, Kazakhstan). The Qarluq 葛邏祿 allies of Gao Xianzhi surrendered to the Arabs, and so the Chinese lost Central Asia. Numerous captives were made by the Arabs, among them Chinese and Central Asian weavers, smiths and painters. These captives probably contributed to the spread of Chinese techniques in the crafts business and a kind of taste for Chinese products and Chinese motifs in the arts.
Among the captives was Du Huan 杜環 who travelled through the Abbasid kingdom in Persia for a dozen of years. When he returned to China, he wrote the report Jingxingji 經行記 that is unfortunately lost. The Counsellor-in-chief (zaixiang 宰相) Jia Dan 賈耽 has written the book Huanghua sida ji 皇華四達記 that includes a lot of information about the geography of the Muslim states in Central Asia and the official envoys between Tang China and the Arabs and Persians. The statements of this book can be compared with the Persian geographer Ibn Khordadbeh's ابن خردادبه (c. 820-912) Kitāb al-masālik wa'l-mamālik كتاب المسالك والممالك "Book of itineraries and kingdoms".
In the 10th century, a lot of Arabian and Persian merchants already lived in Chinese cities like Guangzhou 廣州, Quanzhou 泉州, Yangzhou 揚州 and Hongzhou 洪州 (modern Nanchang 南昌, Jiangxi). They brought with them not only merchandise but also the religion of Islam. The oldest mosque (qingzhensi 清真寺) in China proper was built in Quanzhou during the Northern Song period 北宋 (960-1126). Some contemporary Chinese books describing the Western Asian countries are Zhou Qufei's 周去非 Lingwai daida 嶺外代答 and Zhao Rushi's 趙汝適 Zhufanzhi 諸蕃志. The latter was maritime trade commissioner (shibosi 市舶司) of Quanzhou. Information about the Persians and Arabs was also presented in Zhu Yu's 朱彧 Pingzhou ketan 萍洲可談, Yue Ke's 岳珂 Tingshi 桯史, He Qiaoyuan's 何喬遠 Minshu 閩書, and the treatises in the official dynastic histories.
Meccah is first mentioned in 1236 as Tianfang 天房 (also written 天方). From that time on the term Dashi is exclusively used for Central Asia and not any more as a general designation of Muslims. The Mongolian conquest of Asia so introduced a more detailed knowledge to the Chinese about the countries in the west.