In 1961, the Ark, a Cybertronian spacecraft carrying an invention capable of ending the war between the benevolent Autobots and the malevolent Decepticons, crash lands on thedark side of Earth's Moon. The crash is detected on Earth by NASA, and President John F. Kennedy authorizes a mission to put a man on the Moon as a cover for investigating the craft. In 1969, the crew of Apollo 11 lands on the Moon.
In the present, the Autobots assist the United States military in preventing conflicts around the globe. During a mission to Chernobyl to investigate suspected alien technology,Optimus Prime finds an engine part from the Ark, discovering that it had survived its journey from Cybertron. The Autobots are attacked by Shockwave, who manages to escape. After learning of the top-secret mission to the Moon, the Autobots travel there to explore the Ark. They discover a comatose Sentinel Prime – Optimus's predecessor as leader of the Autobots – and the Pillars he created as a means of establishing a Space Bridge between two points to teleport matter. After returning to Earth, Optimus uses the energy of theMatrix of Leadership to revive Sentinel Prime.
Meanwhile, Sam Witwicky is frustrated that he is unable to work with the Autobots or find a job. He also becomes envious of the close relationship between his new girlfriend, Carly Spencer, and her boss Dylan Gould. After finding work, Sam is provided information by his eccentric co-worker Jerry Wang about the Ark, before Jerry is assassinated by the Decepticon Laserbeak. Sam contacts the now-independently wealthy Seymour Simmons, and together they learn that the Decepticons and their leader, Megatron, are murdering people connected to the American and Russian space missions to the Ark. They locate two surviving Russian cosmonauts, who reveal satellite photos of hundreds of Pillars being stockpiled on the Moon. Sam realizes that the Decepticons raided the Ark long before the Autobots' mission and intentionally left Sentinel and five Pillars behind to lure the Autobots into a trap – Sentinel being the key to activating the Pillars and the Decepticons lacking the means to revive him. The Autobots rush to return Sentinel to their base for protection, but Sentinel betrays them and kills the Autobot Ironhide, revealing he had made a deal with Megatron to ensure the survival of the Cybertronian race.
Sentinel uses the Pillars to transport hundreds of concealed Decepticons from the Moon to Earth. Carly is captured by Gould, who is revealed to be in the service of the Decepticons. The Autobots are exiled from Earth at the demand of the Decepticons to avoid war, but as their ship leaves Earth it is destroyed by Megatron's second-in-command, Starscream, seemingly killing the Autobots. The Decepticons, led by Megatron and Sentinel, seize Chicago as their agents place Pillars around the world. Gould reveals to Carly that the Decepticons plan to transport their home world of Cybertron to the Solar System, then to enslave humanity and use Earth's resources to rebuild their world. Sam teams with U.S. Air Force Chief Robert Epps to go into Chicago to save Carly, but they are nearly killed by Decepticon forces before the Autobots intervene, revealing they concealed themselves during the launch of their ship to convince the Decepticons they were destroyed, as well as to prove to the humans that the Decepticons were untrustworthy.
Working together, the Autobots and human soldiers manage to rescue Carly and kill Laserbeak, Starscream, Soundwave, Barricade, Shockwave, and the Driller, with Optimus using Shockwave's arm-cannon to blast the Control Pillar, disabling the Space Bridge. Sam confronts Gould as he reactivates the Control Pillar, and knocks Gould into the Pillar, killing him. Bumblebee and Ratchet arrive and destroy the Control Pillar, permanently disabling the Bridge and causing the partially transported Cybertron to implode. Optimus and Sentinel fight while Carly convinces Megatron that he will be replaced as leader of the Decepticons with Sentinel. Sentinel severs Optimus' right arm, and is about to kill him when Megatron intervenes, crippling Sentinel. Megatron asks Optimus for a truce, having the desire to become the one in charge of the Decepticons again. Optimus refuses and attacks Megatron, decapitating him. Sentinel tries to excuse his actions, but Optimus executes him as well for betraying his own principles. With the Decepticons defeated, Carly and Sam are reunited and the Autobots accept that, with Cybertron gone for good, Earth is now their home.
- Sunset Shimmer, The Human Mane 5, Shido Itsuka, Kotori Itsuka, Tohka Yatogami, Yoshino and Yoshinon, Reine Murasame, Origami Tobiichi, Mana Takamiya, Godou Kusanagi, Erica Blandelli, Yuri Mariya, Liliana Kranjcar, Ena Seishuin, Star Butterfly, Marco Diaz, Scooby-Doo, Shaggy Rogers, Fred Jones, Daphne Blake, Velma Dinkley, The Sailor Scouts, Ryder, Chase, Skye, Rumble, Marshall, Zuma, Rocky, Katie, Cali, Alex Porter, Doraemon, Noby, Sue, Ace Goody, Sneech, Big G, Dorami, Riruru, Pippo, Lulli, Roboko, Sophia, The DigiDestined and their Digimon (Digimon Tamers and Frontier), Sonic, Tails, Knuckles, Amy Rose, Cream, Cosmo, Chris Thorndyke, Todd, Maurecia, Dana, Myron, Teenage Mutant Ninja Turtles (2012 Version), April O Neil (2012 Version), Casey Jones (2012 Version), Ms. Frizzle, Tim, Arnold, Dorothy Ann, Phoebe, Keesha, Wanda, Ralphie, Carlos, Kim Possible, Ron Stoppable, Rufus, Kat Harvey, Casper the Friendly Ghost, Share, Funshine, Grumpy, Oopsy, Cheer, Mr. Peabody, Sherman, Penny Peterson, and Jack Skellington guest stars in this film
- Kurumi Tokisaki, Athena, Oogie Boogie, Tirek, Darla Dimple, Lucemon, Shredder (2012 Version), Bebop, Rocksteady, Rahzar, Fishface, Tiger Claw, Myotismon, The Grand Duke of Owls, Dr. Drakken and Shego, Captain Hook, Janet, Grizzle, and Team Rocket (Cassidy and Butch) will work for the Decepticons in this film.
- The storyline continues in Tino's Adventures of Transformers: Age of Extinction.