You are not ever supposed to run the generator while plugged into shore power. There is supposed to be either a transfer switch (manual or automatic) OR you have to unplug the rig and plug it into the generator to prevent both sources from powering the rig at the same time.
I do not know why you would start a generator while on shore power. but if that generator applied power to the lines while on shore power, you almost certainly destroyed the generator. I also do not know why the rig would allow you to do that, unless it was wired incorrectly.