To follow your argument to its logical conclusion, why didn't Britain leave the Commonwealth? It has a much larger GDP than most other Commonwealth nations. Britain gains by having a top position in an international club. By remaining in the Commonwealth, India has a leadership position in a worldwide organisation.
The purpose of the Commonwealth is to advance international cooperation, social and economic development and good governance among its members.
As India grows and develops, it can move to being a leader in these areas. There are many members of the Commonwealth that have a lower GDP than India. They look to India for support and leadership. India, therefore, gains by having a good relationship with a variety of countries, from a position of strength.
There is also the symbolism. Being in the Commonwealth is a statement that democracy and the rule of law are important in India. Leaving the Commonwealth would be a symbol of the opposite. These symbols matter. It is part of how India represents itself on the world stage.
Meanwhile India's GDP per capita is still a long way below the European average. India benefits directly from the economic ties with wealthy nations, and leaving the Commonwealth would disenfranchise millions of Indians living as Commonwealth Citizens, stopping them from voting in the UK and other countries that allow Commonwealth citizens the vote. Commonwealth citizens can benefit from consular support at British Embassies. And there is also the Commonwealth Games.
The actual benefits of membership are fairly marginal. Pakistan didn't seem to be hurt much when its membership was suspended. Fiji likewise. But one has to ask, "What would India gain?"