Tony Stark recalls a New Years Eve party in 1999 where he meets scientist Maya Hansen, the inventor of Extremis, an experimental regenerative treatment intended to allow recovery from crippling injuries. Disabled scientist Aldrich Killian offers them a place in his company Advanced Idea Mechanics, but Stark rejects the offer, humiliating Killian. Years later, Stark's experiences during the alien invasion of New York are giving him panic attacks. Restless, he has built several dozen Iron Man suits, creating friction with his girlfriend Pepper Potts. Meanwhile, a string of bombings by a terrorist known only as the Mandarin has left intelligence agencies bewildered by a lack of forensic evidence. Stark's security chief Happy Hogan is badly injured in a Mandarin attack, causing Stark to issue a televised threat to the Mandarin, who responds by destroying Stark's home with helicopter gunships. Hansen, who came to warn Stark, survives the attack along with Potts. Stark escapes in an Iron Man suit, which his artificial intelligence J.A.R.V.I.S. pilots to rural Tennessee, following a flight plan from Stark's investigation into the Mandarin. Stark's experimental armor lacks sufficient power to return to California, and the world believes him dead.
Teaming with Harley, a precocious 10-year-old boy, Stark investigates the remains of a local explosion bearing the hallmarks of a Mandarin attack. He discovers the "bombings" were triggered by soldiers subjected to Extremis, which at this stage of development can cause certain subjects to explosively reject it. After veterans started exploding, these explosions were falsely attributed to a terrorist plot in order to cover up Extremis's flaws. Stark witnesses Extremis firsthand when Mandarin agents Brandt and Savin attack him. With Harley's help, Stark traces the Mandarin to Miami and infiltrates his headquarters using improvised weapons. Inside he discovers the Mandarin is actually a British actor named Trevor Slattery, who claims he is oblivious to the actions carried out in his image. Killian, who appropriated Hansen's Extremis research as a cure for his own disability and expanded the program to include injured war veterans, reveals he is the real Mandarin, using Slattery as a cover. After capturing Stark, Killian kidnaps Potts and subjects her to Extremis to gain Stark's aid in fixing Extremis's flaws and thereby saving Potts. Killian kills Hansen when she has a change of heart about the plan.
Killian has manipulated American intelligence agencies regarding the Mandarin's location, luring James Rhodes – the former War Machine, now re-branded as the Iron Patriot – into a trap to steal the armor. Stark escapes and reunites with Rhodes, discovering that Killian intends to attack President Ellis aboard Air Force One. Stark saves some surviving passengers and crew but cannot stop Killian from abducting Ellis and destroying Air Force One. They trace Killian to an impounded damaged oil tanker where Killian intends to kill Ellis on live television. The vice president will become a puppet leader, following Killian's orders in exchange for Extremis to cure his young daughter's disability. On the platform, Stark goes to save Potts, as Rhodes saves the president. Stark summons his Iron Man suits, controlled remotely by J.A.R.V.I.S., to provide air support. Rhodes secures the president and takes him to safety, while Stark discovers Potts has survived the Extremis procedure. However, before he can save her, a rig collapses around them and she falls to her apparent death. Stark confronts Killian and traps him in an Iron Man suit that self-destructs, but fails to kill him. Potts, whose Extremis powers allowed her to survive her fall, intervenes and kills Killian. After the battle, Stark orders J.A.R.V.I.S. to remotely destroy each Iron Man suit as a sign of his devotion to Potts, while the vice president and Slattery are arrested. With Stark's help, Potts' Extremis effects are stabilized, and Stark undergoes surgery to remove the shrapnel embedded near his heart. He pitches his obsolete chest arc reactor into the sea, musing he will always be Iron Man.
In a present day post-credits scene, Stark wakes up Dr. Bruce Banner, who fell asleep listening to Stark's story.