The film opens with a flashback: as two planets are sucked into a black hole, each one sends out a rocket ship carrying an infant boy of that planet, the last of their kind. One child, a handsome boy endowed with superpowers, landed in a mansion and was admired by all; he became the superhero Metro Man. The other, a blue-skinned baby with super genius, ended up in a prison and was shunned by society; he became the supervillain Megamind, Metro Man's rival.
All is as usual in Metro City: the town felicitates Metro Man with the inauguration of his own museum, when Megamind gatecrashes the event and announces that he has (once again) escaped from prison with the help of his childhood friend/henchman Minion. Following routine, he has once again kidnapped Metro Man's girlfriend, reporter Roxanne Ritchi. Megamind lures Metro Man into a sealed observatory which will be blown up by a laser, but the laser takes too long to start up, so once more Megamind has failed and Metro Man is victorious... but Metro Man can't escape the observatory. He states that the observatory is lined with copper, which drains his powers. Unable to escape when the laser activates, Metro Man is incinerated into a skeleton. Megamind has fulfilled the supervillain's dream, to the shock of everyone (including Megamind himself): he has vanquished the superhero, and Metro City is now his to take over!
Megamind revels in his victory, and sets about vandalizing and pillaging Metro City. However,as time passes he becomes depressed and empty. He realizes that a supervillain has no point without a superhero to fight: without Metro Man, his life has lost all fun, challenge and purpose. He pays a visit to the Metro Man museum to express his condolences, and there meets Roxanne, who has come for the same reason. He disguises himself as the museum curator Bernard, and the two establish a friendship with each other. Roxanne is optimistic that a hero will soon rise to oppose Megamind's villainy, and this gives Megamind an idea: if heroes were 'not born but created', he will create a hero to fight, and thus restore balance to Metro City and purpose to his life!
Megamind uses Metro Man's DNA to forge a special serum that provides superpowers. However at the moment of near completion, Roxanne sneaks into Megamind's lair to find out what his future evil plans are. In the resulting melee the serum is accidentally ingested by Roxanne's friend Hal Stewart, a smug and lazy cameraman who has an obsessive crush on Roxanne and who's been overlooked and ignored his whole life. Despite these qualities, Megamind feels Hal was chosen by destiny for heroics. Megamind, disguised as a Space Dad, trains Hal into Titan, Metro City's upcoming new hero. Titan appears to Roxanne and carries out superhuman feats to impress her, but she rejects him because she likes Bernard.
In the meantime, Megamind carries on a romance with Roxanne through his Bernard alias, which starts to give him hope about a normal life, beyond villainy. This unfortunately creates conflict with Minion, who believes that as villains they'll never find romance or acceptance. A quarrel ensues between the duo, which ends with Minion leaving because he thinks Megamind doesn't need him anymore. Later, at a romantic dinner, Roxanne discovers Megamind's disguise and rejects him.
Heartbroken and friendless, Megamind does what supervillains do: start a rampage across town and a battle with a superhero. But Titan does not show up, and eventually Megamind has to head over to Hal's apartment to pick him up. There he discovers Titan has had enough of rejection, and has decided to strike back and become a supervillain, offering a teamup with Megamind. A shocked Megamind reveals his Space Dad and Bernard identities to Titan and successfully provokes a superhuman fight. But upon defeating Megamind, an enraged Titan tries to murder him; Megamind barely escapes, and Titan proclaims himself Metro City's new supervillain and starts tearing up the town.
Noting that a copper-based attack proved ineffective on Titan, Megamind convinces a reluctant Roxanne to head to Metro Man's lair to check for anything that could help stop Titan. They both check out the base, and discover to their shock that Metro Man is staying there, alive! He explains to them that he'd always wanted to be a musician, but just like Megamind he got typecast and trapped as a superhero, and eventually the role became too unbearable; he thus faked his weakness to copper and subsequent death, to forever rid himself of heroism. He refuses to return, and nominates Megamind as his successor and Roxanne backs him up, but Megamind refuses as he believes he is condemned to be a villain for life.
Megamind turns himself into the prison he was raised, while Roxanne heads into Metro City to try to reason with Titan. Titan, gone over the edge, instead captures Roxanne and makes a TV broadcast to call out Megamind, exhibiting her to make sure he comes. Roxanne begs Megamind to save her and Metro City from Titan, and Minion returns to stand by Megamind's side; this finally inspires him to escape from prison. A fierce battle follows across Metro City, where Megamind eventually defeats Titan by stripping him of his powers, turning him back into Hal.
The film ends with Hal in Megamind's prison cell, and Megamind being accepted and hailed by Metro City as its new hero, with Roxanne as his girlfriend, felicitating his own museum and approval from a disguised Metro Man.