NOTE: Another great spoiler sent in by Rahul.
The movie starts off in a village in Baluchistan (near the Afghan border). A three-car convoy drives towards the village. At a nearby American base, this activity is noticed and passed on to Defense Secretary Callister (Michael Chiklis) in Washington. There's a chance that the convoy is transporting a high-value target. The car enters the village and AK47-toting gunmen get out along, guarding a man, who the face-recognition software can't absolutely recognize as the high-value target. It gives a 51% probability that it's him and recommends aborting the mission. It's unknown whether the man is there to look up a secret stash of weapons or to bury a dead warrior. Callister calls the President on Air Force One and recommends aborting the mission, as the collateral damage will be high. However, the President gives the go-ahead. A Predator UAV (unmanned air vehicle) is launched and remote-fires a missile towards the village. At the last moment, we see it was a funeral procession, as the unsuspecting villagers are engulfed in a massive fireball.
Next we see Jerry Shaw (Shia LaBeouf) at his workplace, Copy Cabana, where he plays poker with his two buddies in the back room. He goads one of the guys into upping the stakes so he can lavish his winnings on his girlfriend. The guy bites and loses aces-over-kings to Jerry. Jerry collects his winnings and leaves. He checks his bank balance at an ATM and sees "Insufficient Funds". On his way home, on the subway, a news channel airs a report of how the government can monitor people through their cell phones, even if it's switched off. Returning home, despite his best efforts of not waking up his landlady, Mrs. Wierzbowski, she finds him at his door. He's late with the rent. He pays her what he has. His phone rings. He gets some shattering news.
He goes to a church, dressed in a suit. The people there react as if they've seen a ghost, seeing him. He walks past his parents towards the coffin, crying inconsolably. In the coffin is... his twin brother, Ethan. Apparently, he died in a car accident. After the funeral, he sits despondently in his brother's room. His brother seems to be quite the over-achiever. His father (William Sadler) tries to talk to him about returning to Stanford, but he blows him off. On his way home, he sees that his father had slipped him a check for $1000. He stops at the ATM to deposit the check. When he checks his balance, it now reads $751,000! He withdraws as much as he can and runs off. Reaching his apartment, he finds the place filled with less-than-legal paraphernalia, like ammonium nitrate canisters, sniper rifles, guns, bombs, fake passports and the like. Suddenly, his cell phone rings. A mysterious female voice tells him that the FBI will raid his place in 30 seconds and he should flee the premises. As she counts down, he retorts that none of this stuff is his. Just then, an FBI SWAT team storms the place and wrestles him to the ground, while he protests his innocence.
Meanwhile, at her home, Rachel Holloman (Michelle Monaghan) prepares to drive her son, Sam, to the railway station, as her deadbeat ex-husband is late. Sam is going to perform with his school band in front of the US Senate. The ex is there to see Sam off. Rachel doesn't even want to speak to him and walks off, after a tender goodbye to Sam. A nervous-looking man, Ranim Khalid, steals Sam's saxophone case. Now alone, Rachel spends her evening with a couple of friends at a bar, drinking. Her cell phone rings. It's the same female voice, instructing her to look at a nearby McDonalds' TV screens. The screens show her son on the train. She is ordered to go to a Porsche Cheyenne and await further instructions, or else her son's train will be derailed. Frightened, she complies.
In the FBI headquarters, sitting in an interrogation cell, he is introduced to Agent Thomas Morgan (Billy Bob Thornton). He tries to plead his innocence, but Morgan is skeptical and questions him about his brother. Morgan accuses Jerry of being involved in terrorism. He tells him that he can keep him there as long as he likes, without granting Jerry his Miranda rights. He walks out and meets Zoe Perez (Rosario Dawson), an Air Force investigator. She informs him that Ethan Shaw was one of theirs. She asks to speak to Jerry, but Morgan will have none of it. As they pass by, a fax machine automatically prints out a memo, granting Jerry a phone call. An FBI agent takes Jerry to a room, where he is left alone to have his phone call. As he dials, the female voice speaks again. It tells him that in 4 seconds, he must get down. A large crane bursts through the window, milliseconds after he ducks. The crash alerts Morgan, Perez and other FBI agents, who rush to the scene. Jerry sees an electronic sign telling him to jump. He does so, and lands in front of a train. He gets out of its way by the skin of his teeth. He sees another electronic sign telling him to board the train. Inside the train, a sleeping guy's phone rings near Jerry, with the words "Answer now Jerry" on it. The voice tells him to stay on the train, but he disobeys and gets on another one. He gets a text message, saying, "You disobeyed". Suddenly, the train stops and starts to back up. The phone rings again, but he refuses to answer. Then everyone else's phone rings and tells them to get Jerry Shaw. As the passengers converge upon him, the doors open and he jumps out. His new instructions are to get to the Porsche Cheyenne.
When he reaches the SUV, he sees Rachel inside. Thinking the other is the one pulling the strings, they quarrel and grab each other, until Jerry mentions the woman on the phone. The female voice comes over the GPS unit and instructs them to drive, as the police are on their way. After a long and suspenseful pursuit, aided by the voice, they enter a junkyard, where they are hoisted up by a crane claw and told to jump onto a garbage barge. The car is then dumped in the water as the cops and Feds arrive. Morgan wants to know who the lady with Jerry was. Perez says she'll go back to Washington to follow up with the Ethan Shaw investigation.
On the barge, Jerry and Rachel introduce each other. His phone rings and they are told to get off the ship and walk along a highway.
In Washington, Perez arrives in Ethan's place, just in time to stop a bunch of soldiers from cleaning up the place. She searches the place, and finds a laptop belonging to the Department of Defense. She tries to access it, but can't. Just then, a convoy of DOD vehicles arrives and she is ordered into a car.
Elsewhere, a bunch of military generals watch a demonstration of a new crystalline explosive, called Hex. Just one small crystal can level a football field, with the aid of a sonic emitter. The production for the crystals begins. However, two boxes - a sonic emitter and a crystal - are diverted. The emitter is sent to Ranim Khalid (the man who stole Sam's sax case). He's a musician. He is instructed to place the emitter inside the F-key of the saxophone. The crystal goes to a jeweler, David Johnson. He is to cut the stone and place it as a diamond setting for a pendant.
On the highway, flanked by high-tension lines, Jerry and Rachel argue about whether Ethan was a terrorist. Just then, Ranim Khalid shows up in a van. He throws them their instructions and the car keys and starts to run away. The voice tells Jerry to stop Khalid or the latter will die. Jerry tries unsuccessfully. The overhead high-tension wires snap and fall, incinerating Khalid. Scared half to death, they are told to reach Indianapolis by 11 AM. After another squabble about Ethan, they reach Indianapolis at 11:02. They are ordered to steal a briefcase from an armored truck and armed escort. They get shotguns from the truck and hold the two armed security guards at gunpoint. They run off with the case. As the guards and the cops give chase, all the nearby buildings' fire alarms go off and are evacuated, flooding the street with people, allowing them to escape. As they pass by a sightseeing bus, they are told to get on the bus, which is full of Japanese tourists. Jerry notices that the briefcase has a countdown timer and the only two things he knows that have timers like this are microwaves and bombs, and this is no microwave.
At a half-hour rest stop, they are ordered to enter a Circuit City home theatre section to finally meet the mysterious handler. When they go inside, they see their entire lives on file. They realize that "she" is a machine - a super-computer. It has deemed the President and other high-ranking dignitaries dangerous and they must be killed. Jerry and Rachel are instructed to get back on the bus to Dayton, Ohio.
Meanwhile, in the Pentagon, Perez is introduced to Defense Secretary Callister, who decides to let her in on the secret. In the secret 36th floor is a large top-secret super-computer, named ARI, which is their weapon against terrorism. Turns out ARI is the one pulling Jerry and Rachel's strings.
Also, Morgan and his team have tracked down Jerry and Rachel, thanks to the Ranim Khalid's body found in the desert and private video footage of Jerry and Rachel boarded the bus. (Networked video footage is controlled by ARI and blocks out Jerry and Rachel's movements.)
Jerry and Rachel get off at the Dayton International Airport. The briefcase passes through security fine, thanks to ARI changing the X-ray image. Suddenly, Morgan sees them and starts to chase them through the airport. With ARI's help, they get through secure doors. Morgan follows them doggedly, through the baggage carousels. After a brief fight on the carousel, Jerry gets the drop on Morgan but doesn't shoot. ARI separates Morgan from them and makes them board a military plane. The baggage timer hits 0 and it opens, revealing a couple of syringes with some concoction in them to keep them alive above 10,000 feet. Taking the injections, they get into a crate. On the way, before passing out, Rachel shows Jerry a photo of Sam and he promises not to let her down.
When they reach their destination, they find that they're in the Pentagon. They get on a freight elevator.
Meanwhile, Perez and Major William Bowman look at tapes of Ethan, on the day of his death. Apparently, he left 3 minutes before schedule and the video shows him walking around flashing his cell phone in Morse Code, spelling out "Fire Extinguisher". At that moment, ARI shuts off the feed and deletes the video, feigning a malfunction. Perez and Bowman go to a blind spot for ARI - the fire extinguisher - and find a memory card hidden there. They watch it and are shocked at what they see. Morgan's on his way to the Pentagon via helicopter. Perez calls him and tries to tell him about the situation, but ARI jams her phone's signal. Perez and Bowman speak to Callister in a clean, eavesdrop-proof room. They unhook the phones so ARI can't listen. ARI tries multiple methods to listen. Finally, thanks to Callister's metal coffee mug, it analyses the vibrations and interprets the sound. It hears as Perez and Bowman play back Ethan's video, captured on the card. It has ARI telling Ethan of its plan, while Ethan tries to talk sense into it. Finally, it declares him an enemy of the state. Callister talks about Project Guillotine, which is the backup plan, should the President or other dignitaries be killed. Apparently, Ethan locked it biometrically and only he can unlock it. Perez disagrees.
In ARI's server room, the soldier is incapacitated by ARI's robotic arm. Jerry and Rachel are ushered in by ARI. Jerry is made to unlock Project Guillotine, biometrically. Rachel is then ordered to kill Jerry, so she can be free. She holds the unconscious soldier's gun on Jerry, but can't do it, despite Jerry's permission. Morgan and others come in, guns drawn and arrest Jerry. Rachel, however, is gone. ARI calls her and tells her that, though she failed, she has another task. Downstairs, she is accosted by the jeweler, David Johnson, and led outside.
As Perez, Callister and Bowman prepare to leave the soundproof room, the large door traps Callister inside. However, he's safe, but Perez and Bowman are not, as the circuit boards around them explode. They manage to escape through the underground sub-flooring.
Jerry is held in a room, but Morgan springs him, telling him that he believes him. Morgan tells him about the Hex crystal and the sonic emitter. Jerry remembers that Rachel's son, Sam, will be performing in front of the Senate tonight. They head for Congress. However, ARI sends a Predator UAV after them. After surviving a couple of fiery rounds with the missile-firing Predator in a tunnel, a mortally-wounded Morgan gives Jerry his badge and gun and tells him to go. Getting in a car, he ploughs into the Predator, sacrificing himself, but destroying the UAV.
In David Johnson's apartment, relaying ARI's instructions, he tells Rachel to dress up and wear the Hex crystal pendant. He gives her a visitor pass for the Capitol. She tries to talk him out of it, but he's too scared to ARI. Beaten, she resigns herself; unaware of the deadly crystal she's wearing.
Callister asks ARI why it's doing this. ARI replies that the President and others are doing more harm than good. They disregarded the low probability (in the beginning of the movie) and that resulted in the deaths of many innocents. Callister was the only one who supported ARI's recommendation. After the President is dead, Callister will be the next President. Perez and Bowman manage to sneak inside ARI's server room and start removing memory modules. Bowman drains off ARI's liquid nitrogen, cutting off it's cooling. However, he and Perez and pushed into the water at the base of the room. As ARI's large sphere (with the cameras on it) approaches menacingly towards Perez, she stabs it with a bar, thereby destroying ARI once and for all.
Jerry gets to the Capitol and flashes Morgan's badge. He is shown into a tunnel. He runs through the tunnel, where a cop confronts him. After a scuffle, he manages to knock out the cop and steal his uniform. An usher shows Rachel inside. To her shock, she realizes that Sam and his school band will be playing the National Anthem here. She starts to run towards her son. Jerry runs inside and sees her being restrained by the guards. As the final few bars of The Star-Spangled Banner approach, requiring an F-note from Sam's saxophone (which will trigger the emitter, which in turn will detonate the Hex crystal), Jerry jumps up on a table and fires in the air. The frightened kids stop playing immediately. A Secret Service agent shoots Jerry.
Next, we see Callister speaking to the Joint Chiefs about ARI's failure. He laments the number of people who died because of ARI. We see that Jerry is still alive, though wounded. He gets a medal and Ethan gets one posthumously. His father stands next to him, immensely proud. Later, he goes to Rachel's house for Sam's birthday. Happy that he remembered Sam's birthday, she kisses him on the cheek.