In the present day, the Decepticon known as Blackout arrives in a U.S. military base in Qatar to find the location of Megatron and the AllSpark. He tries to hack into the files of the computer base, but is stopped by Captain William Lennox and his team. Back in the United States, Captain Witwicky's descendant Sam Witwicky buys his first car which turns out to be the Autobot scout Bumblebee and helps him woo his crush Mikaela Banes. Later, Sam catches a glimpse of Bumblebee's true form when he signals the other Autobots.
On Air Force One, another Decepticon named Frenzy infiltrates the plane and tries to hack into the network again, only this time is more successful until he is stopped by the US Security Defense before he can retrieve all of the file information. Frenzy is then picked up by his partner Barricade and they go after Sam after learning he has the glasses needed to find the AllSpark. Sam is rescued by Bumblebee and Mikaela also learns of the Transformers' existence. Bumblebee fights Barricade and manages to subdue him while Sam and Mikaela decapitate Frenzy, but he still survives.
Meanwhile, Scorponok, who was sent by Blackout, goes after Captain Lennox and his team, murdering one of them and injuring another. During the battle, Scorponok is forced to retreat when he gets injured by sabot rounds dropped him by the Air Force. Sam and Mikaela soon meet Optimus Prime and his other Autobot partners Jazz, Ironhide, and Ratchet. They explain their origins to the two humans and insist on the urgency to get to the Allspark first before the Decepticons, knowing that the Decepticons plan to use it to turn all of Earth's technologies into a new army of Transformers and render humanity extinct. The Autobots bring the two humans back to Sam's house to find the glasses, and they nearly reveal their existence to Sam's parents.
However, Sector 7 agent Seymour Simmons and his team find Sam and take his family away to a classified location after learning Sam came into contact with the Autobots. However, Sam and Mikaela are rescued by Optimus and the Autobots, but Bumblebee ends up getting captured. The Autobots get the glasses and use them to find the AllSpark's location so they can destroy it so the Decepticons cannot get to it. Sam and Mikaela along with two hackers named Maggie and Glenn arrive at the Hoover Dam, where Maggie and Glenn got arrested by the FBI for trying to decipher the information Frenzy stole.
Frenzy finds the AllSpark and gets his body back, then contacts the other Decepticons, Starscream, Bonecrusher, Brawl, Barricade, and Blackout. Starscream attacks the dam and Frenzy frees Megatron from his frozen prison, where he joins his cohorts into chasing down Sam and the Autobots, where Bumblebee has shrunk the cube to a reasonable size. They then get to Mission City, where a large battle ensues. Working together, the Autobots and human soldiers manage to bring down Bonecrusher, Blackout, Brawl. However the war caused Bumblebee to get crippled, and Jazz is killed by Megatron.
Soon, it is up to Sam to decide Earth's fate. Optimus urges Sam to put the AllSpark in his chest, which will destroy them both, but Sam instead inserts the cube into Megatron's chest, which kills him and destroys the AllSpark. All of the dead Transformer bodies are dumped into the Laurentian Abyss in the Atlantic Ocean to be hidden, Sector 7 gets closed down by the President of the United States, and the Witwicky family are released from custody.
Sam and Mikaela soon start a new relationship, and the film ends with Optimus Prime saying that the Autobots' fates have given them a new home, Earth, and sends a message calling out all surviving Autobots to join them.
During the credits, Starscream is shown escaping into space.