It seems like the developers of Civilization V once decided to store aggresiveness index of leaders in a unsigned int. And Gandhi, as the most pacifist leader that he was, was assigned lowest number 1. Also, in the game play if a society adopted democracy, the aggresiveness score was reduced by 2.
So, when Gandhi adopted democracy, his aggresiveness score became 1 - 2 = -1, and as it was unsigned int, and it gained a very high value.
And thus Gandhi was ready to nuke whenever there is a conflict.