Introduction and Background
In Beast Wars and Beast Machines, Megatron was the leader of a group of rogue Predacons who lived on the political fringe of Cybertronian law. The specifics of the new Megatron's origins are not entirely clear, but I'll do my best. But first, how about some background information?
After the Great War that claimed the lives of many Transformers (including Optimus Prime, the commander of the heroic Autobots) ended, the Decepticons were driven from Cybertron and set up base on a dead planet called Charr. The Decepticons at this point were led by Galvatron, the more-or-less reincarnated version of the original Megatron. Galvatron was a pretty unstable guy with a penchant for terrible planning. With the help of the city-sized Headmaster Scorponok, Galvatron led one final assault against the planet Cybertron with the hope of steering it into the sun and being rid of the AUtobots forever. They were defeated, however, and Galvatron was last seen careening through space with his band of Decepticons inside Scorponok. Whether or not he returned is not known since this is where the original continuity ends. It's hard to be exactly sure of what happened after the fact, but there are a few clues we have.
There was some cataclysmic battle on Cybertron that resulted in total victory for the Autobots. Nobody's really sure if the events involving Galvatron's plan to send the planet into the sun are a part of this battle, but I guess it's good to leave some things to the imagination every now and then. At some point, the Autobot and Decepticon factions ceased to exist. They were replaced by the Maximals and Predacons, respectively. It might be reasonable to infer that the original Predacons (a Decepticon subgroup of five members that formed the combiner Predaking) became the leading -con political force after the final defeat of the Decepticons and they may have "sued for peace" with the Autobots or Maximals.
"Megatron is brilliant, but a rogue. He causes too much trouble."
Whatever happened, it's known that Cybertron entered into a precarious peace known as the Pax Cybertronia. From Megatron's own words and actions, the Predacons were more or less seen as second class citizens when compared to the Maximals. The ruling Predacon junta, the Tripredacus Council, was secretly making plans for a revolt, but at a very slow rate. This annoyed Megatron to no end. Megatron seems to have been a Predacon general or warlord or senator or at least some type of office holder. Fed up with what he perceived as being little better than slavery, he stole the top-secret Maximal artifact known as the Golden Disk which was said to contain an encoded description of a planet ripe with energon, the power source of the Transformers. It allowed him to recruit a small crew (composed of Dinobot, a new Scorponok, Terrorsaur, Waspinator, and Tarantulas) and travel in search of the planet. Now a political criminal, Megatron had enemies on all sides, including his own. He stole a spacecraft with time travel capabilities and wound up stranded on a planet with a group of Maximals (led by Optimus Primal) in hot pursuit. Both sides had to adopt organic beast modes that served to protect their technological bodies from the surges of dangerously unstable energon that predominated the landscape of this planet. Megatron himself became a tyrannosaurus rex. The events on this planet became known as the Beast Wars.
Megatron II on Earth
During the Beast Wars, Megatron's second-in-command, Dinobot, left the Predacons and joined the Maximals. The two had something of a very bitter feud from that moment on. In battle, Megatron quickly distinguished himself from his namesake in a number of ways. First, he preferred to sit back and let his soldiers do the fighting while he watched from afar. Second, he relied more on guile and intrigue than brute force. Third, he gave off a rather aristocratic air of superiority that made him seem somewhat effete at times. He often concluded sentences by saying "yessssss" or "noooo" in very drawn-out Lumbergh-like tones.
As time went on, Megatron gained new warriors through the acquisition and reprogramming of stasis pods, incubator-like machines that held protoforms within them. Although Terrorsaur and Scorponok died after falling into a pit of lava, he inherited more than enough warriors to make up for them. Blackarachnia, Inferno, Quickstrike, the immortal mass-murderer Rampage, and a clone of Dinobot all lent support to Megatron. Eventually, the planet they were on was revealed to be prehistoric Earth, and Megatron's motives for coming there were now beginning to become somewhat clearer. The Golden Disk was actually launched from the Voyager spacecraft in the 20th century and it contained an encrypted message from the original Megatron that the new Megatron had decoded. The message was garbled and incomplete, but it was a request for any Decepticon descendants who might find it to go back in time using the new transwarp technology (which the new Megatron had used illegally) to secure victory for the Decepticons. When the Tripredacus Council sent the Decepticon-turned-Predacon Ravage to earth with the mission of destroying all those involved, Megatron revealed the plan to his would-be assassin and showed him the message. Although Ravage was killed, Megatron made his way through the Ark (the Autobots' spaceship) and blasted Optimus Prime's head right off.
To prevent Prime from dying while repairs were being made on his body, Optimus Primal took his spark into his own body to protect it. One unforseen consequence of this was that his mind and body were altered and he more closely resembled his partial namesake in both areas. Megatron saw this and eventually took his own namesake's spark into his body and (after being thrown into lava) gained a red dragon beast mode. Unfortunately, he inherited the original Megatron's instability and absolute disdain for anything organic. Although he no longer possessed the spark of the Decepticon commander for which he was named, he was defeated in the Beast Wars, and all but one member of his army (Waspinator) was destroyed, he would not go quietly into the night...noooo.
The Maximals had to return to Cybertron in a jury-rigged ship made from spare parts of the Ark. Megatron was strapped onto the back for the voyage through time, but at some point managed to free himself and fall forward into time, allowing him to get back to Cybertron even before his captors. Once there, Megatron somehow managed to completely overrun the planet and essentially kill everyone on it. When the Maximals eventually returned, they were greeted by legions of mindless Vehicon drones. Megatron made it his stated goal to destroy every bit of organic material on the planet, in particular the Maximals. He envisioned a purely technological Cybertron, devoid of individual will and conflict. Megatron had become quite the pacifist, it seems, and was not about to allow his former enemies to disrupt his peaceful planet. He created three Vehicon generals -- Jetstorm, Thrust, and Tankor -- to oversee his drones and to root out and destroy the Maximals. Although Jetstorm and Thrust were perfectly loyal to him, Tankor was not. Tankor believed in Megatron's idea of a purely technological Cybertron, but did not think someone with a beast mode (which Megatron still possessed) was capable of leading this brave new world. Tankor attempted to kill Megatron, but when he found he was unable to through virtue of his very programming, he was quickly done away with. When Jetstorm reverted to the Maximal Silverbolt, Megatron created two new generals to take the place of his errant vassals: Strika and Obsidian.
It is here that Megatron's new plan became clear: he intended to consume every single spark on Cybertron and become the sole regulator of the entire planet. Although this made Thrust somewhat uneasy (especially after watching his leader devour a handful of sparks), the three Vehicon generals continued to do their commander's bidding despite the fact that he most likely would have consumed them as well. Ah, loyalty.
Megatron was eventually defeated in a climactic battle with the Maximal commander, Optimus Primal, that killed them both. Through their deaths, Cybertron was rejuvinated and returned to its original state as an organic world. The sparks that Megatron had abducted were now free and everyone was happy and they all danced into the sunset singing songs and blah blah blah.
It's no surprise that this Megatron is a topic of much debate in the Transfan sector. Some people absolutely loathe him and see him as "a pretender to the name." Others see him as the original's superior in every conceivable fashion. I personally rank the Beast-era Megatron right after the Generation 2 comic-era tank Megatron. Love him or hate him, he's undeniably one of the best villains in the extensive Transformers canon.
Did I leave something out? Have a different opinion? Do you just not like me? Do me a favor and /msg me and tell me why. Downvoting me without giving me an explanation is like reviewing a movie by saying "it sucks" and then not giving a reason. It doesn't help anybody improve anything and it certainly doesn't make me want to work any harder.