The Battle of Egypt was a major battle of the Autobots and Decepticons that took place in Egypt on the planet Earth during the Second Cybertronian Civil War.
Before the battle, Sam Witwicky, his girlfriend Mikeala Banes, college roommate Leo and former Sector Seven Agent Simour Simmons along with Autobots, Bumblebee, Twins Mudflap and Skids and former Decepticon turned Autobot Jetfire arrived in Egypt to locate the Matrix of Leadership which is the only thing that can revive the Autobot leader Optimus Prime, who was killed by Megatron in an earlier fight.
After locating the Matrix in a cave, it crumbled to dust in Sam's hand who puts the sand in a sock to carry it and the group began to make their way to meet the US Army and Autobots, along with bringing the body of Optimus.
The battle starts when the Autobots arrive at Egypt. Starscream flies in and does an air strike on Bumblebee attempting to hit him. He misses, but transforms and tries to hit him, still. Sam and Mikaela get out of the car and run to the nearest building. Protoforms star arriving on Earth, and the Autobots begin battling them.
On the top of one of the pyramids, Megatron and Starscream realise that Sam has the Matrix and is going to use it to revive Optimus Prime. Not wanting this to happen, Megatron orders his Decepticons to begin their fight.
Meanwhile Leo, Simmons, Skids, and Mudflap are in a construction site where they see several of the constructions coming. They quickly hide behind a car, while the constructicons begin to transform and combine. They slowly form devastator, who smashes a car, then begins to suck up everything. He sucks up the car, which makes Leo and Simmons run for cover, while Devastator sucks up many people and their homes. Leo and Simmons hold onto a pole, holding on for dear life, while Skids and Mudflap do the same. However, Mudflap lets go and tries to hold onto Skids' face, then lets go again, which fly's into Devastators mouth. Devastator stops sucking up things, and begins to barf up pieces and dust,
Until Mudflap bursts out of Devastators face, alive, and begins shooting Devastator repeatedly.Skids joins by using the crane counterparts on Devastator to fight him. Mudflap does the same, but the two collide on the swing. Devastator begins firing his missiles at Leo and Simmons, while they hide under Devastator, along with Skids and Mudflap.
Then, Devastator slowly moves towards the Pyramid of Giza, where the Star Harvester is hiding inside of the pyramid. Simmons follows him, he gives NEST the coordinates so they can stop Devastator. A gun on a United Nations battleship hundreds of miles away receives Simmons' call and fires on his coordinates. The missiles rip off Devastator's arms and and leg, where he falls off the pyramid and decapitates himself. Although, Devastator was killed, the top of the pyramid was ripped off which exposed the top of the Star Harvester.
Meanwhile, Sam and Mikaela are hiding, where they pass a building, where they encounter Rampage pushing Sam's parents, he rushes to help, but Rampage transforms and aims his guns at Sam, who fell for the trap. Sam's Parents try to help Sam, but Sam tells them to run. Bumblebee then jumps out and begins righting Rampage. Bumblebee is winning, until Ravage runs out from behind and begins shooting Bumblebee. Ravage then jumps onto Bumblebee, until Bumblebee rips out his tail and tears him up, killing Ravage. Bumblebee finishes off Rampage, then puts his Ron and Judy to safety.
Sam and Mikaela hide in a nearby building. However, A Decepticon sends a spy to find them, and he does, while Sam crushes it, then Starscream destroys the building and shoots at them. He misses, while Sam and Mikaela run to Optimus, being chased by the Decepticons. As they run towards Captain Lennox, Ironhide and Ratchet, they rush for cover while Sam runs towards Optimus in an attempt to revive him until suddenly, Megatron arrives and blasts Sam, sending him flying through the air and on to the ground. Megatron flees as the US Armed Soldiers and Autobots begin firing their weapons at him.
Mikaela rushes towards Sam's lifeless body, Lennox tries to revive him and the other soldiers try to do the same, but to no avail. Bumblebee, Ron and Judy mourn for Sam while Mikeala tries to tell Sam to come back for her and reveals her love for him. In another reality, Sam's spirit meets with the spirits of the Dynasty of Primes who tell him that they have been watching him a long time and he has fought for Optimus, the last of the Primes. They tell Sam that the Matrix of Leadership is not found, but earned which is why it crumbled to dust. The Dynasty of Primes revive Sam and the Matrix which Sam uses to revive Optimus Prime by merging it with his spark.
As the revived Optimus crawls to his feet, he realises to his surprise but gladness that Sam has came back for him. Before Optimus can fully recover, the Fallen arrives and attacks the Autobots then teleports to the the Pyramid of Giza along with stealing the Matrix of Leadership. The human soldiers and Autobots tell Optimus that he needs to stop the Fallen as only a Prime can defeat the Fallen while the Fallen along with Megatron activate the Star Harvester.
Several NEST vehicles attempt to shoot at the Fallen, but the Fallen uses his powers to lift the blocks of the Pyramid and tosses them at the incoming jets. He uses his powers again to lift the tanks and throw them against the side of the Pyramid, killing many, many NEST Soldiers. Scorponok then jumps out the sand and severally wounds Jetfire. Jetfire smashes Scorponoks head with his cane, killing Scorponok. Jetfire, too wounded beyond repair, sacrifices his spark and parts to heal Optimus. Jolt then transports the parts of Jetfire to Optimus, who becomes Jetpower Optimus Prime.
With his new upgrade, Optimus blasts off towards the Pyramid to fight the Fallen. As the Fallen uses pyramid's rubble to prevent the Autobots and humans from stopping him, Optimus flies through the rubble and knocks the Fallen off the pyramid. With a single shot from his rifle, Optimus destroys the Star Harvester and engages in a fierce dual with the Fallen. As the two fight, Megatron tries to defend his master by attacking Optimus, because he has now become more stronger, Optimus easily overpowers Megatron by blasting his face with his own weapon, amputating his arm with his energon sword and giving him a mighty blast from his Jet cannons which sends a wounded Megatron through a wall. Optimus continues his fight with the Fallen while having his sword and one of his cannons ripped off by the Fallen and slammed into his face. As the Fallen prepares to finish Optimus off with his spear, Optimus grabs hold of the spear and angrilly tells the Fallen, "You picked the wrong planet!" then stabs the Fallen in the shoulder with his own spear. Optimus demands the Fallen to give him his face by ripping it off with the spear, realising that he has been overpowered, the Fallen tries to flee but Optimus kills the Fallen by ripping his spark out of his chest and crushes it in his fist. As the Fallen's lifeless body falls to the ground, Optimus says a victory line "I rise, you fall!"
Horrified by his master's death, Megaton watches as Starscream approaches and adds that he may not call him a coward but sometimes, cowards do survive. Swearing revenge on Optimus, the humans and Autobots, Megatron declares that the war is not over and flees with Starscream, realising that they have lost again to the heroic Autobots and humans.
After the battle was over, the humans and Autobots travel back to USA on one of the United Nation ships with Optimus thanking Sam for reviving him and Sam thanking Optimus for believing in him.