Gandhi was coded to be less aggressive than everyone else his base aggression was set to and integer of 1 instead of 2 like everyone else.
That integer was supposed to decrease as civilizations adopted more peaceful forms of government. However, the coding for Civ 1 only used a positive 8-bit integer to count aggression. So given Gandhi's inherent peacefulness decreasing his "agression" eventually made it tick from 0 to -1, but since the coding was a positive 8-bit integer there was no -1 value and integer underflow error flipped that to the max value of 255. Hence, Gandhi nuking the entire planet every single game.