Gandhi was one among the many popular freedom fighters in India. He had his own way to dealing with an occupying force. His way is extreme pacifism and non-violence. Many of his followers were killed by British in following the path made by Gandhi.
While the followers of Gandhi were dying and beaten up at the hands of British forces, Gandhi used to be put in prison where he continued his fast and non-violence ways. Gandhi was never an existential threat to Brit rule. He was more of a nuisance for them.
Whether Gandhi's non-violent ways worked or not, it can be debated for years. But the British were leaving India anyway after the WW2. Following independence, the leftist historians have ensured that Gandhi was made the face of the Indian freedom struggle. Indian Congress party still milk Gandhi's name in elections. As kids we were singing songs on how Gandhi gave us freedom from oppressive British rule
The brainwashing starts early.