
Megatron and the Decepticons Weren't the Bad Guys (Initially)
One of the things that makes Megatron and the Decepticons such compelling villains is that they were initially fighting for a legitimate cause. In the Transformers lore, Megatron began as a revolutionary who opposed Cybertron’s oppressive caste system, where a bot’s role and social status were determined at birth.
He saw how the ruling class (many who would later become Autobots) either benefited from or were willfully blind to this injustice.
In that sense, Megatron was right: Cybertron needed radical reform. We even see some scenes of him educating Optimus Prime (Orion Pax) on what oppression for him was like. Megatron's name was D-16, and he suffered as worker. Optimus Prime (Orion Pax) was a clerk and was upset that he couldn't go to an amusement park.
It makes sense that Megatron resented Optimus Prime when he received the Matrix of Leadership. Megatron mentored Optimus about the caste system and its flaws, yet Optimus got it even though he didn't go through the suffering Megatron went through. Megatron's mistake was saying that it should've been removed by force. Optimus didn't say that.
With his righteous anger, it transformed into hatred, and his desire for liberation became a lust for power and domination. He turned into the very thing he despised. His motivation was justified, but his actions were not. By the time the war was in full swing, Megatron was no longer fighting to free Cybertron’s oppressed; he was fighting to rule over everyone.
Megatron proved that a just cause can be corrupted, and that you die a hero or live long enough to become the villain.
If only he went about it a different way, things could've been different.