Megatron is the leader of the Decepticons.
In the Transformers 1986 movie, Megatron led an attack on Autobot city which Megatron and his Decepticons killed several Autobots(WheelJack, Windcharger, Brawn, IronHide, Ratchet, and Prowl)
Megatron and Optimus then fought each other which in the end caused Megatron to get gravely injured and Optimus very injured and dies later.
Megatron pleaded Soundwave to help him back to the ship in which Soundwave helped him back to the ship.(In Which Soundwave and Megatron are bros for life)
Starscream dumps the injured Decepticons off of the ship(Megatron, ThunderCracker, Skywarp, and the insecticons)
Megatron and the other injured decepticons came across Unicron and he reapaired all of them into upgraded bodies. Skywarp became Cyclonus, ThunderCracker became Scourge, the insecticons became Sweeps and finally Megatron became Galvatron.
Megatron appeared in Generation 1, Generation 2, Beast wars, Transformers live action Trilogy. (More to be added)