This is probably one of the most shared pieces game lore, but it isn't actually true! Sid Meier himself explained in his memoirs.
Civ 1 only has three aggresion levels, and Gandhi always stayed at the lowest one, like many others leaders. A programmer might have to correct me here, but the language the game was written in (C) doesn't even have unsigned integers by default.
The myth probably spread out because it's a fun story, and being nuked by Gandhi is just a funny memorable thing that stuck with people. I haven't verified this, but he also has the Scientific trait, which means he's likely to reach the nuclear tech before other Civs.