When it comes to Civ games, Gandhi’s behavior can be a bit questionable. This isn’t just in Civilization 5, but every Civilization game out there. Peace-loving Gandhi loves only one thing more than a cultural victory. Nukes.
There is a reason for that based in the first Civilization game. In the original game democracy lowered the aggression rating for world leaders by 2, and with Gandhi having the lowest score of 1, when he took the path of Democracy his aggression rating dropped to -1. In terms of the code, that -1 then jumped up to the highest possible aggression rating of 255.
Afterwards, it stayed as a long running joke / Easter egg in the series, with his nuclear tendencies being a solid 12 — the highest rating for other non-player characters is an 8. So when it comes down to forming an alliance with him, you’ll end up being the doting parent who spoils the child. If you don’t meet every need Gandhi has, he will nuke you. If you are too much of a warmonger, he will attack you in the effort of peace. If you stop his efforts of spreading religion for his religious victory, he will nuke you.
Joking aside, Gandhi was historically known for things like the Salt March, his hatred of the British, and his life-long fight for the independence of India. While he is idolized for his behavior for his country, he still had a questionable past in relation to his family, adultery, Hitler, and non-Indian minorities. So maybe keeping the bug in game is somehow justifiable.