I don't know if this is done in good faith, but perhaps more as a "screw you" to China. India and China don't have the best relations, nor does Japan wish to see that change in the future.
Any country investing in another does so in their own self interest. The reasons are seldom altruistic.