I'll mostly be drawing on an article by Charles Verlinden on trade in the Indian Ocean, which focuses more on South Asia. Hopefully someone can chime in regarding earlier Chinese-Indian trade.
The trade routes on the Indian ocean comprise one of the most ancient trade networks, and routes of trade between China and the Arab peninsula go back to at least the Chinese Han dynasty (206 BC-220 AD). Looking more generally at cases of trade being conducted via Indian realms, the Muslim trade in the western part of the Indian Ocean is of importance, especially following Arab expansion in the 7th c. According to the Arab traveller Sulaiman, Arab vessels would pass through Quilon (on the Malabar coast), on to Sri Lanka, to Kalah Bar (Kedah) on the Malaysian coast, and from there on to Java, Sumatra and China (usually reaching Khanfu or Canton in southern China). The Muslim merchants in turn did commerce with the Jewish Radanya traders, who “were the only ones who formed a commercial contact between the Mediterranean and the Indian ocean” - from central France up to China. The trade routes described above are mentioned by Inb Khordadbeh in the mid-9th century. However, Jewish trade in these regions became more restrained during the 11th and 12th centuries, focusing on the route between Egypt and Cairo thereafter.
Both Jewish and Muslim traders would leave the Persian Gulf in winter, spend the summer in Canton, and return with the monsoon the following winter [note: Knowledge of the monsoons was central to trade in the Indian Ocean, and the European colonial Powers in Early Modern times only gradually adapted this ancient knowledge for their navigation.]. An important Arab outpost was stationed in Canton from the mid 8th c., but was destroyed by the Chinese in 878. Following this, Chinese, Arab and Jewish merchants met in Malaysia.
As your question concerns more directly trade between China and India, I'll quote a relevant passage from Verlinden regarding Chinese navigation:
It seems that from the beginning of our era, Chinese ships had already reached the Coromandal coast, but it was largely from the ninth century onwards that they became the vessels of the high sea. Under the Sung dynasty (960-1127), naval construction progressed remarkably, and towards the end of the eleventh century the Chinese used a primitive compass. Under the Sungs of the south, (1127-1279), China carried out a considerable naval action in Indonesia up to the Gulf of Bengal. […] Under the Mongols of China, contacts were established with Sri Lanka, with Quilon on the Malabar coast and with Ormuz in the Persian Gulf. Chinese merchants then established themselves at Kaveripattinam, Quilon and Calicut.
These are by no means the earliest voyages between India and China (there were travels undertaken by Chinese Buddhist pilgrims going back at least to the 4th c. AD), but seem to be a quite early attempt at constructing trade outposts in India. Later Chinese expeditions include those by Zheng He in the 15th c., which reached areas from South Asia up to eastern Africa. These however did not have concrete economic political results, and the following Ming rulers, the Hongxi and Xuande Emperors, halted these voyages.
To sum up: Direct trade between India and China goes back to at least the 13th century, with Chinese merchants established in modern-day southern India, especially the Malabar coast. However, trade with China via India, conducted especially by Muslim and Jewish merchants, has more ancient precedents, from at least the 9th century.
Source: Verlinden, Charles: The Indian Ocean. The Ancient Period and the Middle Ages, in: The Indian Ocean. Explorations in History, Commerce and Politics, Satish Chandra (ed.), New Delhi 1987.