Meanwhile, on Earth, Daniel Witwicky and Hot Rod race to greet the shuttle. They notice its damaged exterior and spot Decepticons aboard the damaged shuttle, upon which Hot Rod fires at the stowaways. After a brief battle pitting Hot Rod and Kup against the Decepticons Blitzwing and Shrapnel, the Decepticons begin their attack on Autobot City. The outnumbered Autobots, including Autobot City Commander Ultra Magnus, Blurr, Springer, Perceptor, and female Autobot Arcee, fare poorly. Ultra Magnus sends orders to alert Blaster to radio for assistance from their commander and leader Optimus Prime. An attempt to thwart the transmission by Decepticon Soundwave fails, and the broadcast reaches Moon Base One where Optimus is stationed. Optimus Prime and the Dinobots arrive to successfully repel the Decepticon invaders, including the unstoppable Devastator. Optimus faces Megatron in a battle that leaves Optimus mortally wounded and Megatron severely damaged. The Decepticons retreat with Megatron and their other war-wounded loaded aboard Astrotrain for transport back to Cybertron, on the orders of Starscream.
Inside Autobot City's walls, Perceptor alerts the other Autobots that the wounds that Optimu
s Prime has suffered during his battle with Megatron are fatal. The dying Optimus Prime calls on Ultra Magnus to assume command of the Autobots and bestows him with the Autobot Matrix of Leadership, which Optimus extracts from his chest. Optimus asserts that the Matrix one day will light the Autobots darkest hour, right before he dies. Back in space, Astrotrain's shortage of fuel prompts the Decepticons to eject the dead weight of their injured — including the protesting Megatron. This leaves the remaining Decepticons to bicker among themselves for leadership.
Drifting aimlessly, the Decepticon castoffs encounter Unicron, who offers to give Megatron and the others new bodies on the condition that they destroy the Autobot Matrix, which, Unicron says, is the only thing that can stand in his way. Megatron reluctantly agrees, and Unicron uses his power to kill Megatron off, recreate, and reformat him as Galvatron, with his damaged underlings fashioned anew into Cyclonus, Scourge, and the Sweeps. Unicron provides them with a craft on which they travel to Cybertron, where Galvatron confronts and obliterates the treacherous Starscream and takes command of the Decepticons, as his alter-ego Megatron did before him.
Back on Earth, the Autobots are alerted as Unicron consumes Cybertron's two moons, along with Autobots Jazz, Bumblebee, Cliffjumper and Daniel's father Spike (who are ultimately rescued). Galvatron leads the Decepticons in another assault on Autobot City. The Autobots board a pair of shuttles and flee toward their threatened planet of Cybertron. Hot Rod, Kup and the Dinobots are shot down over the planet Quintessa, while Ultra Magnus and company evade their pursuers and set down on the planet of Junk for repairs.
Captured by Quintessa guardsmen, Hot Rod and Kup witness the sentencing and execution of Orbilus and are then subjected to a trial by Quintesson executioners. Before the trial, they see Kranix, now Lithone's last survivor, who then tells them about Unicron, before he's taken away by the Quintessa guardsmen to be fed to the Sharkticons. At the trial, Hot Rod and Kup battle the Sharkticons with difficulty, but luckily, they are rescued only by the arrival of the Dinobots. Grimlock intimidates the Sharkticons to rebel against the Quintessons with ease, while the Autobots escape. With help from the Dinobots' new ally, Wheelie, the group locate a ship and depart for the planet of Junk to join the other Autobots.
Meanwhile, Galvatron finds and hunts down the Autobots on Junk. Ultra Magnus tries but fails to awaken the Matrix's powers, and then is obliterated to pieces by the Sweeps. Galvatron steals the Matrix, stating that he intends to use it to make Unicron his slave. The remaining Autobots are harassed by hostile Junkion natives, led by Wreck-Gar, until Hot Rod's party touches down to befriend them. The Junkion allies repair Ultra Magnus and volunteer a vessel to help the Autobots fight against Unicron.
Back in space, Galvatron attempts to subjugate Unicron using the Matrix but is unable to unleash its power. Unicron, seeing that Galvatron is underestimating him, transforms into a huge planet-sized robot and attacks Cybertron. As protest against this, Galvatron opens fire on Unicron, but Unicron simply swallows him up. Decepticon defenders scramble to counter Unicron's attack, but he destroys each one of them, including Shockwave, Dirge, Thrust, Ramjet, and countless others. As the Autobots reach the scene, Hot Rod crashes his ship into through the giant's eye and finding themselves separated within Unicron's body. At that time, Wreck-Gar and his Junkions fight back against Unicron, but Unicron crushes their only ship, although they survived.
Inside, Hot Rod fights the recently consumed Galvatron. Hot Rod secures his grip on the Matrix, and the power of The Matrix is unleashed, transforming him into Rodimus Prime. Rodimus unleashes its power to destroy Unicron from within, but not before he throws Galvatron deep into space, landing on the volcanic planet Thrull. Rodimus leads the other Autobots out of Unicron's body before it explodes, sprawling parts of the giant across the galaxy. Reclaiming Cybertron, the victorious Autobots declare the beginning of a new age of peace and happiness while the defeated Decepticons scramble away to a burned world called Chaar. Ultra Magnus decided to step down his position as leader of the Autobots, handing it over to Rodimus. The movie ends with Unicron's monstrous head circling Cybertron, a dark replacement for the two moons that once existed. The movie ends, the screen freezes, the credits roll as an extended version of the movie's theme song plays, then everything stops, followed by a fadeout.
Character deaths:
An intention of the movie was to rid the Transformers cartoon universe of the majority of characters from Seasons 1 and 2. Story consultant Flint Dille elaborated:
“ In the next season , we were going to have all these new characters, and people are going to be wondering what happened to the old characters that they liked so much. What we knew, in a business sense, is that they had been discontinued, because they were the 1984/1985 (toy)line – but, we needed to tie them off. So, we had this one scene where the Autobots basically had to run through a gauntlet of Decepticons. Which basically wiped out the entire '84 product line in one massive "charge of the light brigade". So, whoever wasn't discontinued, stumbled to the end. That scene didn’t make it into the finished movie. But if you think kids were locking themselves in the bedroom over Optimus Prime, basically in that scene they would've seen their entire toy collection wiped out. ”
The movie was produced by Sunbow/Marvel simultaneous to G.I. Joe: The Movie. The writers of the G.I. Joe film asked for permission from Hasbro to kill a character, Duke. Hasbro not only approved the request but "insisted" that the writers of Transformers: The Movie adopt the same fate for Optimus Prime. However, Optimus Prime's death sparked some controversy which later caused the writers to make changes so that Duke simply ended up in a coma.