When GDP is calculated on nominal dollar terms, it not only leaves out many important factors but also uses an exchange rate of currencies that do not reflect the real strength of an economy. However, when calculated on PPP (Purchasing Power Parity) terms, the difference in the GDP calculated on nominal exchange rate ranges from very less to nothing to negative.
When this calculation is done for developing countries, the GDP increases 2-3 times as it happens in the case of India where it leaps over four times from $2.5 trillion to over $10 trillion, making it the 3rd largest economy. PPP calculation pushes China's GDP growth 1.5 times to $25 trillion making it the largest economy in the world ahead of the United States whose GDP remains static at $20 trillion when calculated on PPP terms.
The PPP calculation gives you an indication of the value of a currency within the borders of the country it represents. The cost of an essential product or service in the US is at least 25 times more on average than what it is in India. For instance, if a half liter bottle of Pepsi costs Rs. 30 in India, the same bottle will cost an equivalent of the value of Rs. 750 in the US.
That's a straightforward case of price inflation for an Indian. An American won't pay Rs. 750 for that bottle of Pepsi in India...he'll pay Rs. 30 like every other Indian. Now, why things are 25 times costlier in the United States is for that country to figure out. It's not the purpose of this answer to go too deep into that.
I gave this example to explain that GDP calculated on such inflated exchange rates is clearly erroneous and is a misrepresentation of the value of resources, goods, and services in a country. The PPP calculation is the closest thing to perfection we have right now, to measure GDP and by that calculation, India is the third largest economy by a long way.
The fourth-largest economy, Japan, is not even half the size of the Indian economy while China's economy is not five times larger but one and a half times larger than India's economy. It's a gap that India can hopefully narrow in the years ahead.