Plot
Cybertron is a technological world formed by the body of the metal deity Primus and inhabited by sentient robots fueled by a substance called Energon, who live in a hierarchy based on whether they possess a 'transformation cog' that allows them to shapeshift into vehicles. In the underground city of Iacon, Orion Pax, a cogless mining robot, sneaks into an archive to learn about the first Cybertronians, the Thirteen Primes. Security guards spot and chase Orion, but his best friend, D-16, helps him escape. Later, during a cave-in at the Energon mine where they work, the two break protocol to save fellow miner Jazz. However, this worsens the disaster, and their superior, Elita-1, gets blamed for it and demoted by their callous overseer, Darkwing.
Iacon's leader, Sentinel Prime, returns from an expedition to the surface to find the lost Matrix of Leadership, the absence of which has caused Energon to stop flowing and forced the miners to extract it. Though unable to find it, he reprieves the population with a race. To prove themselves as more than just miners, Orion enters himself and D-16 illegally using jet packs, but they narrowly lose. While Sentinel promises to reward them for boosting mining morale, Darkwing, enraged at Orion and D-16 for sabotaging him in the race, drags the two to garbage incineration, where they meet the eccentric B-127. Finding a distress message from the Prime Alpha Trion in the garbage, Orion convinces D-16 and B-127 to travel with him to the message's coordinates on the surface; also persuading Elita to join when she catches them sneaking out of Iacon.
The group finds Alpha Trion in a cave, deactivated alongside the other Primes' corpses. Upon reactivation, he reveals that Sentinel is a pretender who betrayed the real Primes to steal the Matrix, only for it to disappear when Primus deemed him unworthy. In truth, Sentinel has been giving Energon to aliens called Quintessons in exchange for letting him rule Cybertron, and he created the current hierarchy by removing some Cybertronians' cogs before activation. Alpha Trion gives the group the fallen Primes' cogs—allowing them to transform—and a chip with evidence of Sentinel's treason. They are then ambushed by Sentinel's lieutenant, Airachnid, who captures Trion and brings him back to Iacon, where Sentinel executes him.
Evading pursuit, the group rushes back to Iacon but is captured by the Primes' former army, the Cybertronian High Guard, who are rebelling against Sentinel. While D-16 takes command of them by defeating their leader, Starscream, Orion grows concerned over his aggression since learning the truth. Sentinel's troops find them, and in the ensuing battle, the evidence chip is destroyed while D-16, B-127, and Starscream are captured along with most of the High Guard. Taken to Iacon, D-16 learns that Sentinel stole the cog of his idol, Megatronus Prime, whose face his captors mockingly brand onto him.
Encouraged by Elita, Orion rallies remaining High Guard members Soundwave and Shockwave, and returns to Iacon to rescue their comrades. After subduing Darkwing, Orion enlists the miners' aid to assault Sentinel's headquarters, freeing the captives. As the High Guard battles Sentinel's forces, Orion, Elita, and B-127 expose the truth by capturing Airachnid and broadcasting her memory recordings throughout the city. D-16 defeats Sentinel but gets into an argument with Orion over whether to kill him, resulting in D-16 accidentally shooting Orion before deliberately letting him fall to his death. D-16 then kills Sentinel, takes Megatronus' cog, renames himself Megatron, and leads the High Guard into a riot.
Deeming Orion worthy, Primus and the Primes' spirits bestow him with the Matrix and revive him as Optimus Prime, who defeats Megatron and exiles him and the High Guard from Iacon. The Matrix then makes Energon flow again and restores the miners' cogs. Afterward, Optimus becomes Iacon's new leader, christens his followers as Autobots, and sends a warning message for the Quintessons to stay away from Cybertron. Meanwhile, a vengeful Megatron reforms the High Guard into the Decepticons, using Megatronus' face as their insignia, and declares war on the Autobots.