Sixty-five million years ago, a race of aliens begin wiping out most life on Earth. Herds of brachiosaurids and hadrosaurs panicked trying to run as fast as they can from the cyberformed energy but did not escape in time. In the present, somewhere in the Arctic, a geologist named Darcy Tirrel discovers Tyrannosaurus and Spinosaurus. corpses covered in a strange metal.
Five years after the Battle of Chicago, humanity has grown wary and fearful of the Transformers. Cemetery Wind, an elite CIA black ops unit was formed by paranoid agent Harold Attinger and team leader James Savoy, has been assigned to hunt down the remaining Decepticons, but have also been secretly in hunting down the Autobots, believing them all to be a threat, despite the Autobots officially granted sanctuary by the government. With the aid of a Cybertronian bounty hunter Lockdown, they ambush and brutally kill Ratchet. However, their primary target is Optimus Prime, whom Lockdown personally wants alive.
In rural Texas, Cade Yeager, a struggling inventor, and his friend Lucas Flannery buy an old truck to strip it for parts to send Cade's daughter Tessa to college. Cade soon discovers that the truck is an injured Optimus Prime and repairs him after unexpectedly bringing him back to life. Locating Optimus in Texas, Cemetery Wind and Lockdown confront and threaten the Yeagers before Optimus rescues them and attacks the soldiers. Cade, Tessa and Lucas are saved by Tessa's secret boyfriend, Shane Dyson. After a long chase through the town, one of Lockdown's grenades instantly kills Lucas while the others escape. Tensions rise between Cade and the two teenagers over their secret relationship while Optimus rallies the remaining Autobots: Bumblebee, Hound, Drift, and Crosshairs. Cade hacks into a drone he took from the Texas attack, learning of KSI (Kinetic Solutions Incorporated), a robotic corporation, partnering with Cemetery Wind, and they decide to infiltrate KSI headquarters in Chicago, with Optimus vowing to kill Attinger for his crimes and actions against Autobots.
Meanwhile Joshua Joyce, the head of KSI, shows Darcy that he has perfected Transformium, the metal that the Transformers are composed of, but needs more. He has imprisoned Brains to decode dead Transformers' and utilize their data for human-created Transformers. Joshua shows Darcy his prized creation Galvatron, created using data from Megatron. The Autobots storm the facility, but Joshua stops them, proclaiming the Autobots are no longer needed now that they can create their own Transformers, and then Optimus and the Autobots decide to leave.
Forced by Attinger, Joshua launches Galvatron and Stinger (a man-made Transformer similar to Bumblebee) along with Sounndblaster created from soundwave remains and buzzsaw to pursue them while two new deceptions cyclones and slipstream watch from a distance. Optimus fights Galvatron before Lockdown wounds him, capturing him and Tessa on his ship. He explains that beings he calls the Creators want Optimus back and takes the matrix desiring to use its power. Before leaving Earth, Lockdown gives Cemetery Wind a Seed, but the Autobots use this time to board the ship. Cade and Shane save Tessa and escape with Bumblebee while the others save Optimus and attack the bridge and after a heated battle optimus defeats and kills lockdown and the autobots lock the mercenaries up and take the ship. Optimus and Brains reveal that Galvatron is Megatron reborn and has manipulated KSI in order to steal the Seed and create a new Decepticon army. Cade warns Joshua, who retreated to Beijing to use production facilities there, about Galvatron and Attinger. Joshua backs off his deal with Attinger while Galvatron activates himself and infects all the KSI prototypes, turning them into the Decepticon army. Joshua flees with the Seed to Hong Kong, with Attinger and savoy fleeing.
When the Autobots try to retrieve the Seed, their ship is damaged by the Decepticons, and the Yeagers, Hound and Bumblebee leap down to fight. After Cade help Joshua keep the bomb safe, the Decepticons leave the Autobots outnumbered. Knowing this, Optimus releases and tames the legendary warriors known as the Dinobots. With their help, they defeat the Decepticons while Bumblebee and grimlock the warriors leader kills Stinger cyclonus and slipscream at the battle's climax. However, galvatron attempts to claim the seed from the humans. Optimus jumps in and fights his arch nemesis. Cade tries to help, but is held at gunpoint by savoy, who is angered by Cade's choice to side with the Autobots. Optimus saves Cade by killing him, but is immediately impaled by galvatron with his sword to a wall. As Cade and Bumblebee holds off and distract him, Tessa and Shane use a tow truck to pull the sword out of Optimus, who then kills Galvatron. They finish off the remaining Decepticons as soundblaster takes lockdown ship and departs for space swearing revenge. Optimus sets the Dinobots free and decides to hide the Seed, knowing it must be kept safe. He requests to remain with Cade and his family before sending a message to the White House that he is there for human kind.
- Mark Wahlberg as Cade Yeager
- Nicola Peltz as Tessa Yeager
- Jack Reynor as Shane Dyson
- Kelsey Grammer as Harold Attinger
- Stanley Tucci as Joshua Joyce
- Sophia Myles as Darcy Tirrel
- T. J. Miller as Lucas Flannery
- Titus Welliver as James Savoy
- Li Bingbing as Su Yueming
- James Bachman as Gill Wembley
- Thomas Lennon as Chief of Staff
- Cleo King as Mary Jo McGatlin
- B. Adam Baillio as Timothy
- Greg Anderson as Joshua's Assistant
- Abigail Klein as Joshua's Assistant
- Melanie Specht as Joshua's Assistant
- Victoria Summer as Joshua's Assistant
- Erika Fong as CIA Analyst
- Charles Parnell as CIA Director
- Kenny Sheard as Cemetery Wind member
- Mikal Vega as Cemetery Wind member
- Han Geng as Convertible Passenger
- Zou Shiming as Elevator Boxer
- Byron Li as Hong Kong Police Officer
- Austin Lin as Attinger's Driver
- Candice Zhao as Woman in Elevator
- Teresa Daley as Assistant to Minister of Defense
- Peter Cullen as Optimus Prime
- Mark Ryan as Bumblebee
- John Goodman as Hound
- John DiMaggio as Crosshairs
- Ken Watanabe as Drift
- Reno Wilson as Brains
- Robert Foxworth as Ratchet/Leadfoot
- Frank Welker as Megatron/Galvatron
- KSI Boss
- Two Heads
- Aston Martin Decepticon
- Barricade (video footage)
- Protoforms (video footage)