On the Decepticons' return journey to Cybertron following their attack on Autobot City in the Earth year 2005, a mortally wounded, but still functional Megatron was jettisoned into space along with several other fallen Decepticons in order to reduce Astrotrain's mass in order to reach Cybertron. The end seemed to be near for Megatron -- but it was not to be, as he summoned by Unicron, who made him an offer - in return for Megatron's service, he would give him a new body and new troops to command...
On the Decepticons' return journey to Cybertron following their attack on Autobot City in the Earth year 2005, a mortally wounded, but still functional Megatron was jettisoned into space along with several other fallen Decepticons in order to reduce Astrotrain's mass in order to reach Cybertron. The end seemed to be near for Megatron -- but it was not to be, as he summoned by Unicron, who made him an offer - in return for Megatron's service, he would give him a new body and new troops to command. Megatron initially refused, enraged at the thought of being Unicron's servant. However, faced with obliteration as his only alternative, Megatron reluctantly accepted Unicron's offer, and was reformatted as Galvatron.
Commanded by Unicron to destroy the Matrix of Leadership, Galvatron first returned to Cybertron to settle an old score with Starscream, who had set him adrift in space and was now being crowned as the new Decepticon leader in a pompous ceremony. Demonstrating his new power, Galvatron obliterated Starscream with a single blast from his new cannon mode. The other Decepticons quickly accepted Galvatron as their leader. Unicron's subsequent consumption of Cybertron's moons enraged Galvatron, but when Unicron mentally tortured him to put him in his place, Galvatron's resentment of his master began.
Leading another attack on Autobot City, he pursued Ultra Magnus and the Autobots to the Planet of Junk, where he seized the Matrix from Ultra Magnus, and attempted to use its power against Unicron. Unable to open the Matrix, Galvatron was powerless as Unicron transformed and attacked Cybertron with his bare hands. Unicron swallowed Galvatron in contempt, while swatting away Cybertron's Decepticon defenders like flies. Shortly thereafter, a group of Autobots entered Unicron's body, where the youthful Hot Rod encountered the humiliated Decepticon leader. Although Galvatron initially proposed an alliance with the Autobot against Unicron, he was once again tortured mentally by Unicron, who tells him to destroy Hot Rod otherwise Galvatron himself will be obliterated. Galvatron weakly agrees, still accepting Unicron as his master, and then engaged Hot Rod in battle. Galvatron quickly attained the upper hand over the weaker Autobot. However, when Hot Rod seized the Matrix from Galvatron, he was reformatted into Rodimus Prime, and hurled Galvatron through Unicron's armor and into the void of space, before unleashing the power of the Matrix and destroying Unicron.
Now leaderless and forced off Cybertron by the Autobots, the Decepticons retreated to the ruined world of Chaar, where they bickered and fought amongst each other over their limited energon resources. Galvatron's Unicron-created lieutenants, Cyclonus and Scourge set out to find their leader's body using the information stored in Unicron's memory banks and traced him to the planet Thrull. They found Galvatron immersed in a pool of lava-like plasma, and rescued him only to discover that Galvatron had been driven insane (the official diagnosis, provided in the later episode, Webworld, is that the plasma seeped into Galvatron's head casing and embrittled his metaprocessor, causing him to become irreversibly mad (which probably explains why his voice changed)). After attacking his own minions, he then returned with them to Chaar, only to discover that the Decepticons had sided with the Quintessons in an attack on the Autobots in exchange for Energon. Heading for the planet, Galvatron opened fire on his own forces, and then confronted the Quintessons themselves, who tricked him into an alliance with the promise of leading him to the fictitious "Decepticon Matrix of Leadership". A joint Decepticon/Quintesson attack on both Cybertron and Earth almost allowed the Quintessons to claim ultimate victory when they activated a switch that nullified all Transformers, but when Spike Witwicky reversed the effect, Galvatron turned on the Quintessons, who only just managed to escape his wrath.
Source: Wikipedia