In 1961, a Cybertronian spacecraft crash lands on the far side of the moon. Known as the Ark, it was the last ship to escape a Cybertron devastated by war. Piloted by Sentinel Prime, it carried "the Pillars", technology that could save the Cybertronians once and for all. On Earth, the crash of the Ark is detected by NASA, and President John F. Kennedy authorizes the mission to put a man on the moon as a cover. In 1969, Apollo 11 lands on the surface of the Moon to investigate the Ark.
In the present day, the Autobots have forged a military alliance with the United States, but largely act independently in stopping humans from destroying themselves. During a mission in Chernobyl at the request of the Ukrainian government, Optimus Prime discovers a fuel cell from the Ark (which awakened Shockwave) that the Soviet Union attempted to use as a power source, resulting in the Chernobyl disaster. Knowing this, Optimus launches his own mission to retrieve the Pillars and revive Sentinel Prime. Just five Pillars remain on-board the vessel, which the Autobots describe as being the means to establish a mobile space bridge between two points and transport matter through. U.S. National Intelligence Director Charlotte Mearing (Frances McDormand) is horrified at this revelation as the Pillars could be used to bring an invading army to Earth.
Meanwhile, Sam Witwicky is frustrated by his life after graduating from college as he hasn't been able to find a job. He takes his frustrations out on his girlfriend, Carly Spencer, and her close relationship with her playboy accountant boss, Dylan Gould (Patrick Dempsey). Sam is eventually hired in a mail room in a high-pressure working environment. One of his co-workers, Jerry Wang (Ken Jeong), takes an unusual interest in Sam's activities before revealing himself to be a conspiracy theorist. He passes information on to Sam about "the dark side of the moon" before being assassinated by Laserbeak, a condor-like Decepticon. After contacting the retired Seymour Simmons (John Turturro), Sam realizes that the Decepticons are systematically killing people connected to the American and Russian space missions. They locate two Russian cosmonauts who fled to America after the Soviet space program was shut down. The cosmonauts have photos taken by Soviet satellites that clearly show hundreds of Pillars being stockpiled on the Moon. Sam realizes that the Decepticons raided the Ark decades beforehand and are luring the Autobots into a trap: unable to revive Sentinel Prime on their own, they left him and five Pillars - including the Master Pillar, which controls all of them - for the Autobots to find. Sam contacts the Autobots and reveals that Sentinel Prime is being targeted by the Decepticons, and escort him to their base. However, Sentinel reveals that he made a deal with the Decepticons and betrays both the Autobots and the humans, destroying their base and executing Ironhide before fleeing with the Pillars.