Megamind (Will Ferrell) is a super-intelligent alien and the supervillain of Metro City who continually battles - and loses - against his nemesis, Metro Man (Brad Pitt), a rivalry that has extended since the two arrived on Earth as infants. On the day of dedication of a museum in Metro Man's honor, Megamind escapes from jail, rejoins his sidekick Minion (David Cross), and kidnaps reporter Roxanne Ritchi (Tina Fey) to lure Metro Man into a copper-lined observatory. Inside, Metro Man weakens because copper drains his powers and is killed by a death ray that Megamind fires at the observatory from an orbiting satellite. Megamind revels in his victory, but this is short-lived as without a nemesis, his villainy has no purpose.

Megamind prepares to destroy the Metro Man statue, saying his last goodbyes, but is forced to take the holographic disguise of the museum's curator Bernard (Ben Stiller) when Roxanne approaches. Roxanne unwittingly gives Megamind the idea to inject Metro Man's DNA into a worthy target to create a new superhero for him to challenge. Megamind returns to his lair and creates the serum, unaware Roxanne and her dimwitted cameraman Hal (Jonah Hill) have snuck in. Chaos breaks out when Roxanne is discovered, and ultimately Hal is accidentally injected with the serum. Later, Megamind disguises himself as Hal's "space dad" to groom him into being a superhero as to lead to an all-out battle with Megamind in the near future. Hal adopts the name "Tighten", a misunderstanding of Megamind's suggested name "Titan". During this, Megamind continues to see Roxanne using the Bernard disguise and the two develop a relationship. Minion becomes upset that Megamind wants to date Roxanne and has foregone his villainy, and leaves Megamind.

On the night before Hal's battle with Megamind, Megamind takes Roxanne out to dinner, unaware that Hal, who also had feelings for Roxanne, has watched them. Megamind's disguise falters during dinner, and Roxanne rejects him, even after Megamind admits his feelings for her. He further misplaces his invisible car, which has the anti-serum to revert Hal to normal. Despite these setbacks, he prepares to meet Hal, but the hero does not show up. Instead, he finds Hal bitter at losing Roxanne to Bernard, and has begun using his powers for ill-gotten gains. Megamind tries to convince Hal to stop by revealing how he had manipulated him, but this infuriates Hal further, with Hal threatening to kill Megamind. Megamind tries to catch Hal in a copper-lined trap but this fails to stop Hal, and he along with Roxanne flee the city as Hal threatens the rest of the city with his powers.

Roxanne leads Megamind to Metro Man's secret lair, hoping to find something to stop Hal, and are astonished to find Metro Man there. The superhero explains that on that day, he had had an epiphany, wanting to forgo the superhero business to go into music, and so he had faked his death. Metro Man refuses to help despite the danger to the city. Roxanne tries to convince Megamind that he could be the hero, but Megamind believes that he is destined to be the villain, and turns himself in at prison. While he is there, Roxanne is captured by Hal, who threatens to harm her if Megamind does not fight her. Having a change of heart, Megamind requests the warden for his release, but discovers that the warden is really Minion in disguise, who also has had a change of heart and returned to help.

Megamind rescues Roxanne, but Hal impales him with the pinnacle of Metro Tower. Metro Man shows up to berate Hal and chase him away. Roxanne goes to Megamind but finds that he was actually a holographically-disguised Minion, otherwise unharmed. Megamind reveals that he had disguised himself as Metro Man as part of the plan. However, Hal returns, having realized the deception from the unique way Megamind had spoken as Metro Man, and begins to fight Megamind. In the battle, Megamind stumbles on his invisible car, and quickly fires the anti-serum at Hal. Hal is reverted to normal and taken to prison, while Roxanne convinces both Megamind and the city's populace to make Megamind their hero. Some time later, Megamind and Roxanne are in a budding relationship, and the city dedicates a new statue to Megamind, with Metro Man, disguised in the crowd, silently congratulating his friend.