In the near future, Michael Jennings is a reverse engineer; he analyzes his clients' competitors' technology and recreates it with improvements. To protect his clients' intellectual property and himself, Jennings undergoes memory wipe to remove knowledge of his engineering with aid of his friend Shorty.
Jennings is contacted by his college roommate James Rethrick, the CEO of technology company Allcom. Rethrick offers Jennings a lengthy three-year job, during which he will be required to stay on Allcom's campus, in exchange for company stock. Jennings is hesitant but agrees. After being injected with the memory marker, Jennings is given a tour of the campus, where he meets and flirts with biologist Dr. Rachel Porter. Rethrick then introduces Jennings to his work partner, physicist William Dekker.
Three years later, Jennings wakes from the memory wipe and is congratulated by Rethrick. Jennings finds that the Allcom stock he earned is valued at over US$92 million, but when he goes to see his lawyer to get the funds, he discovers that he had given all the stock away just weeks ago. Further, he is given an envelope claiming to be his possessions on entering Allcom, but it contains a random assortment of items. Confused, Jennings soon finds himself detained by the FBI. Agent Dodge accuses Jennings of having access to classified government designs that had been taken by Dekker, who is now dead. Jennings cannot answer due to the memory wipe, but finds a means to escape using the items in the envelope. As he evades the FBI, Rethrick's right-hand-man John Wolfe sees Jennings walking away and warns Rethrick they have a problem.
Jennings meets with Shorty to try to figure out what happened, but then sees a lottery number result on a television, the numbers matching those on a fortune cookie message in the envelope. He realizes that he must have built a machine at Allcom to see into the future, planting items in that envelope to help fix things. At Allcom, Rethrick tries to use Jennings' machine, but instead finds that it was jury-rigged to go offline after Jennings had left. Rethrick studies Jennings' habits while at Allcom and discovers that he got romantically involved with Porter and left a secret message to meet her at a cafe later that day. Rethrick sends a body double to try to coerce Jennings to turn over the envelope, but the real Porter shows up and rescues Jennings. The two elude the FBI and Rethrick's men. While hiding, they find that the stamps on the envelopes contain microdot images taken from the device, showing newspaper headlines from the future that while Allcom became incredibly successful with the device, it led to international political strife and the United States launching a pre-emptive nuclear strike. They agree that the machine must be destroyed.
Using the last items in the envelope, Jennings and Porter gain access to Allcom and the machine, while separately the FBI have started to investigate Allcom. Jennings discovers the circuit he rigged and fixes it, while booby-trapping the machine to be destroyed in a few minutes. He uses the machine one last time to see himself being shot at by an FBI agent in the catwalks about the machine. Rethrick, Wolfe, and other men arrive, and Jennings and Porter escape to the catwalks. Wolfe tries to use the machine to help track Jennings, while Rethrick corners the pair on the catwalk. FBI agents storm the lab, and one appears on the catwalk, the same tableau that Jennings had seen. As the FBI fires, a watch from the envelope beeps, and Jennings dodges in time for the bullet to fatally hit Rethrick. Wolfe is killed as Jennings' booby-trap goes off and destroys the machine. After the chaos dies down and the FBI begin a full investigation, Agent Dodge finds the watch Jennings had used.
Elsewhere, Jennings, Porter, and Shorty have moved to the countryside. Shorty was able to use his influence to rescue the cage of a pair of lovebirds Porter had been raising at Allcom. Recalling the fortune cookie message from the envelope, Jennings looks in the cage and finds a lottery ticket for the winning jackpot of US$90 million.
Ben Affleck as Michael Jennings, a reverse engineer
Uma Thurman as Rachel Porter, a biologist and Jennings's lover
Aaron Eckhart as James Rethrick, a billionaire CEO
Colm Feore as John Wolfe, Rethrick's right-hand man
Peter Friedman as Attorney General Brown
Paul Giamatti as Shorty, Jennings's friend
Michael C. Hall as Agent Klein
Ivana Milicevic as Maya-Rachel, the double for Rachel
Kathryn Morris as Rita Dune
Joe Morton as Agent Dodge
Additionally, Krista Allen appears as The Projection in a 3D computer Michael developed.
based on the 1953 short story of the same name by science fiction writer Philip K. Dick