Indian investment in Chabahar port in Iran is undertaken out of necessity and to challenge both Pakistan and China. The objective of India in funding the Chabahar port are:
- To project India's infrastructure prowess by building it's first offshore port in the Gulf.
- To create a sea trade route bypassing Pakistan.
- To create an alternative land route to Afghanistan.
- To counter China's Belt and Road Initiative and provide Eurasia with an alternative route through Iran.
- To improve relationship with Iran, reduce Pakistan and China's influence there and project India's soft power in Gulf.
Pakistan has often denied India permission to freely trade with Afghanistan, and this has often curtailed Indian and Afghanistan interests and relationship. The creation of an alternate trade route for Afghanistan will help Afghanistan increase its connectivity with the rest of the world, and reduce its dependence on Pakistan.
India will develop and operate the Chabahar port. India Ports Global, a recently formed port project investment arm of the shipping ministry and a joint venture between the Jawaharlal Nehru Port Trust and the Kandla port, will invest $85 million in developing two container berths with a length of 640 metres and three multi-cargo berths. ... State run railway body IRCON International will set up a railway line at Chabahar to move goods right up to Afghanistan. The 500-km rail link between Chabahar and Zahedan will link Delhi to the rest of Iran's railway network. - The Economic Times, May 2016

The full development of the port would lower landlocked Afghanistan’s dependence on Pakistani ports for assured access to the sea. Besides, the trilateral arrangement could balance joint forays by China and Pakistan into the Indian Ocean. In February, Pakistan decided that China would operate its Gwadar port, just 76 km from Chabahar. For the first time, Gwadar would provide Chinese ships sustained anchorage in an area on the edge of the Arabian Sea, not far from the Strait of Hormuz, through which the bulk of the world’s energy supplies pass. - The Hindu, May 2013
It is a part of the International North–South Transport Corridor (NSTC) to provide Eurasia an alternate trade route with India:
In addition to the China-led New Silk Road, Eurasian players are boosting the development of the North-South International Transport Corridor which aims to connect South Asian countries with North and Western Europe ... The North-South International Transport Corridor (ITC) is the ship, rail and road route which aims to increase transit and foreign trade freight flows within the Eurasian continent. The initiative to connect the Indian Ocean and Persian Gulf to the Caspian Sea and beyond to North and Western Europe via the Russian Federation was kicked off back in September 2000 in St. Petersburg by Russia, Iran and India. The agreement was ratified by the founding states in 2002 ... its major advantage compared to other transport routes, most notably the Suez Canal, is that it will reduce the transportation distance at least by half, thereby cutting the transit time and cost. - Sputnik International, August 2016

“India now maintains a balanced West Asian policy of maintaining good relations with Saudi Sunnis, Iranian Shias and Israel’s Jews,” he said. “It is a policy all three have come to understand, perhaps even appreciate.” - Quartz, May 2016
If it is undertaken to challenge Gwadar, is India in a reasonable position to challenge China in this region?
It isn't just about India and China though.
Iran in particular too has been keen to develop the port since the 1970's. Its then ally, the US, even wanted to develop it as a naval base but the plan was dropped after the Shah of Iran was deposed. So Iran has a long vested interest in developing Chabahar that it is unlikely to abandon. (In fact, it had even invited China and Pakistan to invest in the port and develop it). Iran's strategic interest to develop the port cannot be ignored here:
But far outweighing the economic significance of Chabahar and under-played both by India and Iran is the strategic significance of Chabahar when developed to its fullest potential.
Iran would be able to have an Indian Ocean deep-sea port, the first for Iran outside the Gulf. Iran has had notable naval ambitions to emerge as a regional naval power in the North Arabian segment of the Indian Ocean. Chabahar’s development and the economic activity that it would generate would enable Iran to undertake sizeable development of its outlying Eastern Regions bordering Pakistan. It would also enable Iran to adopt a stronger defensive posture on its Eastern Border with Pakistan, and neutralise Pakistan’s propensity of providing its territory as a springboard for external military intervention in Iran.
...It needs to be noted that Iran did extend an invitation to China and Pakistan to participate in the development of Chabahar but they did not express interest. Reasons for their disinterest are fathomable. Only Japan has expressed willingness to participate in the Indian effort to develop Chabahar. - Chabahar’s Imperatives To Emerge As Flagship Of Iran-India Strategic Partnership – Analysis
The project has indeed faced a lot of hiccups and delays primarily because of US sanctions against Iran. India has often had to do a fine balancing act between Iran and US which did slow down the project. Russian interest and participation has helped counter US sanctions and speeded up the project, and increased Iran's commitment to the project as it allows it to counter the US imposed economic isolation.
Afghanistan falling again under Taliban's control did result in a deterioration of its relationship with India and hence India's foreign policy ignored it temporarily. However, India also hopes to invest in Iranian gas field in the future to increase and secure its energy needs and so Chabahar port continues to be of strategic interest to India in which India will continue investing in it despite the hurdles from foreign powers. Iran also has historic and cultural ties with India and improving its relationship with India, and not being dependent on China, is also an important priority for Iran too. They are thus highly unlikely to let either Pakistan or China derail this project:
When China clinched a massive $400 billion bilateral investment pact with Iran, a 25-year deal that seeks to revive the heavily sanctioned and economically isolated nation, few noted that India was already well-engaged.
By the end of May, India will begin full-scale operations in its first foreign port venture at Iran’s Chabahar, a facility that opens on the Gulf of Oman that will aim to facilitate more South Asia, Central Asia and Middle East trade while bypassing Pakistan.
... It’s not immediately clear how the new China-Iran deal will work, if at all, to develop Iran’s trade and port infrastructure as the precise terms of the bilateral partnership have not been made public.
If it does, India will have a distinct first-mover advantage through its nearly completed development of two terminals at Chahabar’s Shahid Beheshti complex that opens onto the Gulf of Oman.
... Chabahar has seen limited operations since 2019, a result of US restrictions imposed on Iran’s energy exports ... That’s set to change. New Delhi ultimately aims to link Chabahar to its International North-South Transport Corridor (INSTC), a project initially proposed by India, Russia and Iran in 2000 and later joined by 10 other Central Asian nations.
.... Initial estimates suggest INSTC could cut current carriage costs by about 30% and travel times by half. That means more trade and port activity for Iran and less for Pakistan, according to industry experts. The Asian Development Bank (ADB) claimed last year that Iran has already usurped 70% of Pakistan’s recent transport business at Karachi port. - India has key first-mover edge on China in Iran
So no, I do not see China de-railing the Indo-Iran Chabahar port project anytime soon, because it is in Iran's interest not to. China cannot invest in the project because it competes with Gwadar port and the move will displease Pakistan. Its other option is to completely abandon the Gwadar port project and sign a deal with Iran to take over the Chabahar port. But that can damage relationship with Pakistan.