We already have energy sources that are much cheaper than coal when you take all the costs into account. If you start demanding that renewable energy must be cheaper than coal when coal gets huge effective subsidies and renewable energy gets none, that's an artificial constraint that makes the problem unsolvable.
Why does China use coal? If you truly want India and China to switch sources then you need to check all the boxes. No one is going to sacrifice when they are bootstrapping.
Why has China started investing heavily in renewable energy? For one, they want the status of a modern country that's leading the world in important matters; they don't want to be a shitty third world country stuck in the nineteenth century. For another, they're tired of constantly choking on coal smoke.
> they want the status of a modern country that's leading the world in important matters
Yes, their military spending and quest for a blue water navy is number one on that list.
They continue to use coal as the main source of energy because it is what the west did and its a know quantity, reliable, and cheap. They are increasing their attempts at other energy but a lot of that comes from their desire to stay dominant in all forms of manufacturing. If they can subsidize and crush the manufacturing in other countries (such as the US), they will do it.
reply