Sparkplug creates a frankenstein-type autobot using spare parts, which he called Autobot X. Not the best name, but Sparkplug isn’t a poet, he’s a robot mechanic. Naturally, Autobot X instantly goes insane and starts smashing shit.
Before they can put Autobot X on ice, the DECPTICONS attack and things blow the hell up, like you’d expect. Spike is critically wounded in the battle, so they do the only reasonable thing and transfer his “mind” into Autobot X’s “body”. It works, and but Autobot X (now called Autobot Spike) is crazy and starts wrecking shit again. They attempt to use TV to calm him down, but wouldn’t you know it? Frankenstein is on, and Spike loses it and runs off.
Megatron finds Spike in the wilderness and uses his confused state to turn him “evil”.
There’s a huge showdown, of course, with a lot of “will he or won’t we” between Optimus trying to talk sense into Autobot Spike, and Megatron getting him to shoot at the Autobots.
In the fracas, Spike shoots at Sparkplug and knocks him off a cliff, which jars his robo-brain into being a good guy again. Spike uses Megatron to shoot at the Decpticons befroe Megatron and his boys beat it.
Back at the Ark, they zap Spike back into his human body.
See transformers wiki entry on this episode.