In 484 CE, King Arthur leads his knights and men into a battle they can't hope to win. Having realized this, he enlists the help of the magician Merlin, who negotiates with a Cybertronian Knight. The Knight gives Merlin a staff wielding ultimate power; the twelve Cybertronian Knights combine to form Dragonstorm, who comes to Camelot's aid and wipes out their adversaries.
In the present day, Optimus Prime is absent while Transformers remain outcasts on Earth. Despite this, Transformers are increasingly arriving on the planet. Several governments formed the Transformers Reaction Force (TRF) to hunt and destroy Transformers of all factions; Cuba has become a safe haven for Transformers, with Topspin and Seymour Simmons hiding out there. In an area of war-torn Chicago, a group of kids stumble upon a crashed alien ship with a Cybertronian Knight inside. The kids are confronted by a TRF Walker, which is destroyed by Isabella, a survivor of the Battle of Chicago, and a young pegasus filly Selena, who is also a survivor of the Battle of Chicago. Izabella, Selena, and her Transformer companions, Sqweeks and Canopy, urge the kids to escape, but Canopy is shot by a TRF plane drone and dies. Shortly after, Bumblebee and Cade Yeager, Brian Griffin, Peter Griffin, and Blythe Baxter arrive and help the kids escape. Yeager finds the dying Knight, who gives him a metallic talisman. Barricade observes and informs Megatron (whom Ernie the Giant Chicken and his buddies work with) that Cade has the talisman.
In the last few days, the Transformers' home world, Cybertron, has been approaching Earth. Optimus crash-lands on the planet, awakening him from stasis. Finding that Cybertron has been disassembled into pieces, Optimus confronts his maker, a powerful sorceress named Quintessa; she corrupts him, so he does her bidding — destroy Earth/Unicron, so Cybertron can live. But soon, Arceus and all the other Legendary Pokémon, Little Bear and his friends befriended on their adventures have sensed the arrival of Cybertron and they all leave to find Brian, and his friends. Lennox, a former N.E.S.T. member who now works under the TRF, speaks with General Morshower, his former superior, about the presence of an ancient alien technology on Earth. This technology can help bring Cybertron into Earth's atmosphere, but only through the use of the staff given to Merlin. The TRF makes a deal with the reborn Megatron, who demands the release of his fellow Decepticons — Onslaught, Mohawk, Nitro, and Dreadbot. Megatron and his team go off to find Yeager.
Yeager, Brian, and the others hide out at a junkyard, which serves as a sanctuary for many of the surviving Autobots — Bumblebee, Hound, Drift, Crosshairs, Grimlock, Slug, Wheelie and others. And Sylveon is pregnant with another child. While there, Yeager and Brian find that Izabella and Selena have followed them back; Yeager tells them to leave but Izabella wants to stay and fight. And Selena want's to be adopted since her mother died in the Battle of Chicago, but Brian refuses, but Selena won't leave until Brian changes his mind. Megatron's Decepticons and the villains arrive at the junkyard and attack the Autobots; in the ensuing chaos, most of Megatron's warriors are killed except Nitro and Barricade. Yeager, Brian, Peter, the guys, the LPS gang, Roger, Minerva, Bender, and Team Natsu are confronted by Cogman, a Headmaster, while an Oxford professor named Viviane Wembly is kidnapped by the Autobot Hot Rod. They're all brought to England and meet with Sir Edmund Burton, the last living member of the Witwiccan Order. Burton tells Cade, Viviane, Brian, and the others of the Transformers' origins, saying that the collision of Cybertron with Earth would spell certain doom. He tasks Viviane, the last descendant of Merlin, with obtaining his staff so they can prevent an ancient machine from being activated. Burton tells Yeager that, as a person defined by honor and dignity, he is the last knight. The talisman given to Yeager has wrapped around his arm by this point. The group are forced to evacuate Burton's home when the TRF arrives.
With Yeager's help, Viviane delves into her father's past, and finds that they must take the H.M.S. Alliance into the sea to find the staff inside the ancient machine. Bumblebee, Yeager, Viviane, and our heroes go to the Alliance with Cogman and Burton, who declines to go on the journey any further. The Alliance heads for the machine, but is intercepted by a TRF submarine. The Alliance ventures inside the machine, where Viviane, Yeager, and our heroes find a chamber of Cybertronian Knights, as well as Merlin's staff. One Knight, Skullitron, awakens and attacks them. The TRF intervenes and attacks Skullitron who falls to his death, while Viviane activates the staff and the machine rises towards the ocean's surface. As more Knights rise up to fight, Optimus, redubbed "Nemesis Prime" by Quintessa, intervenes, and takes the staff from Viviane with the intention of restoring his homeward.
Bumblebee confronts and fights Optimus on top of the machine, as Yeager, Brian, the others, and Lennox struggle to step in. As Optimus is about to kill Bumblebee, he speaks, urging Prime to remember who he is. Optimus breaks free of Quintessa's control, but Megatron and the villains fly in and seizes the staff from Optimus. The Cybertronian Knights then attack Optimus for his betrayal, but Yeager — whose talisman becomes the Excalibur sword — stops the fight. The Knights yield to Yeager, who urges Optimus to protect the Earth once more.
At Stonehenge, Megatron, Nitro, Barricade, and the villains work with Quintessa and use the staff to activate the machine, controlling Cybertron. As the military intervenes, Megatron shoots Burton, who dies by Cogman's side. Optimus unites the Knights, and they become Dragonstorm. Using Lockdown's ship, they set off to stop Cybertron's collision with Earth. They raid Cybertron and battle against the Decepticons and Infernocons, Quintessa's soldiers. The Autobots, Legendary Pokémon, and TRF soldiers destroy the Infernocons and guide Viviane, Cade, and our heroes so they can get to the staff. As Quintessa commences Cybertron's resurrection, the Autobots battle Megatron, who is defeated by Optimus and escapes after being kicked out by Optimus. Lois duels with Diane who claims she has the high ground, but Diane tells her she underestimated her power. Lois tells her to don't try it, but Diane does so as Lois handicaps her. Quintessa is destroyed by Bumblebee, also kills Nitro. And most of the villains are soon defeated by the Legendary Pokémon, as Peter kicks Ernie out of the Chamber falling to his death. Viviane removes the staff — stopping the collision of Cybertron.
The Autobots reunite following the battle, as Sylveon shows the others her newbron cub, and decided to call her "Breon". And Brein decides to adopt Selena. Optimus declares that his faith in humanity has been restored, and with Earth and Cybertron connected, they must work together to rebuild their worlds. Optimus sends a message to any surviving Transformers, telling them it's time to go home. The Autobots use Lockdown's ship to return to Cybertron. As the Legendary Pokémon return back to their normal destinations.
In a mid-credits scene, scientists inspect a part of Unicron. Quintessa, who has survived and disguised as a human, arrives and offers them a way to destroy the being.
- The Griffin Family (Peter, Lois, Chris, Meg, and Stewie), Vinny Griffin, Glenn Quagmire, Cleveland Brown, Joe Swanson, Roger Smith, Bender Bending Rodríguez, Minerva Mink, Blythe Baxter, Zoe Trent, Pepper Clark, Penny Ling, Vinnie Terrio, Sunil Nevla, Minka Mark, Russell Ferguson, Gail Trent, Mitzi, Buttercream Sunday, Nutmeg Dash, Sugar Sprinkles, Youngmee Song, Sue Patterson, Jasper Jones, Belle, Ariel, Princess Jasmine, Kida Nedakh, Little Bear, Duck, Cat, Owl, Hen, Emily, Lucy, Doug Funnie, Skeeter Valentine, Natsu Dragneel, Lucy Heartfilia, Erza Scarlet, Gray Fullbuster, Wendy Marvell, Happy, and Carla guest star in this film.
- Ernie the Giant Chicken, Sideshow Bob, Bobby Briggs, Diane Simmons, Sonja, James Woods, Bertram, R2-Q5, Gaston, Brittany and Whittany Biskit, Cashmere and Velvet, Madame Pom LeBlanc, Team Galactic (Mars, Jupiter and Saturn), and The Dazzlings will work for Megatron in this film.
- The My Little Pony: Equestria Girls franchise, Littlest Pet Shop, and Transformers were both made by Hasbro.
- This film marks it's first appearance of Selena and Breon.
- In this film, Brian, the Eeveelutions, Vinny, Roger, Bender, Minerva, Peter, Quagmire, Cleveland, Joe, the LPS gang, Stewie, Natsu, Lucy, Gray, Erza, Wendy, Happy, and Carla will go with Cade and Bumblebee, while the others stay with Izzy, Jimmy, and the other Autobots.
- The storyline continues in Ed, Edd, n Eddy's Ed-ventures of Transformers 6.
- Opening/The Dark ages/In the present
- At the Chicago ruins
- Optimus' arrival on Cybertron/Quintessa
- Edmond and Viviane's introductions
- With the others and other Autobots
- The mysterious horns/Tessa calls Cade
- Alliance with Megatron and Ernie
- Decepticon and Drone chase/Meeting Cogman
- Flying to the UK/Optimus becomes "Nemesis Prime"
- Vivane captured/Meeting Sir Edmond Burton
- The Story of the Transformers
- Finding the clues/Road chase
- Hopping aboard the Sub/Submarine chase
- Burton talks to the prime minister
- Back on the sub/Finding the Knight Ship
- Arrival of Cybertron
- Finding Merlin's staff
- Optimus vs. Bumblebee
- Race to Stonehenge
- Flying to Cybertron/The battle on Cybertron
- Stopping the collision
- The Autobots return to Cybertron/Quintessa's still alive!/Ending
- Sarah Brightman & Chris Thompson - I Will Be With You (for the end credits)