U.S. Army pilot Captain Colter Stevens (Jake Gyllenhaal), last aware of being on a mission in Afghanistan, wakes up on a commuter train to Chicago, at 7:40 am. To the world around him   including his traveling partner Christina Warren (Michelle Monaghan) and the bathroom mirror   he appears to be Sean Fentress, a school teacher. As he comes to grips with this revelation, the train explodes, killing everyone aboard.
Stevens regains consciousness inside a dingy dim cockpit, leaking oil. Communicating through a video screen, Air Force Captain Colleen Goodwin (Vera Farmiga) verifies Stevens' identity, and insists he stay "on mission" to find the bomber before a large "dirty bomb" hits downtown Chicago in six hours. Inside the "Source Code" experimental device designed by scientist Dr. Rutledge (Jeffrey Wright), he experiences the last eight minutes of another compatible person's life within an alternative timeline.
Stevens is unwillingly sent back into the Source Code repeatedly in frustrating, exhausting attempts to learn the bomber's identity. He tries to warn authorities on the train and flee with Christina, escaping the explosion. Other times he cannot locate or disarm the bomb and dies on the train. But Rutledge insists the alternate timeline is not real. It is revealed that he has been "with them" for two months since being reported killed in action in Afghanistan. He is comatose and missing most of his body, hooked up to neural sensors. The cockpit capsule is in his imagination, his brain's way of making sense of a missing environment. A confused and frustrated Stevens asks, "As one soldier to another, am I dead?" Angry to learn that he is on life support, he asks to be disconnected after the mission. Rutledge agrees.
Stevens catches the bomber Derek Frost (Michael Arden), who leaves his wallet behind to fake his own death, and gets off at the last stop before Chicago. In one run-through, Frost kills both Fentress and Christina, and flees in a rented white van. Stevens remembers the license number and direction and the authorities use this information to catch the terrorist, preventing him from detonating the dirty bomb. The mission finished, Rutledge reneges on his promise, ordering Goodwin to wipe Stevens' memory for a future mission. Stevens convinces Goodwin to allow one more try, to save everyone on the train, despite Rutledge's insistence that everyone on the train had already been killed in the explosion.
Stevens is sent back into the Source Code where he disarms the bomb, subdues Frost and handcuffs him to a handrail inside the train. He reports the bomber to authorities, sends an email to Captain Goodwin, then calls to reconcile with his estranged father under the guise of a fellow soldier. He asks Christina what she would do if she knew that she only had seconds left to live, and starts to kiss her. At the same time, Goodwin approaches the air-tight chamber that contains the torso of Stevens' comatose mutilated body, disconnects the life support, and Stevens dies. Rutledge bangs on the outer door in vain. The scene cuts to Stevens finishing the kiss with Christina inside the Source Code, revealing that the alternate timeline of the Source Code has become real, contrary to what was proposed by Rutledge. They continue on the train, and then walk through downtown Chicago to the Cloud Gate, a sculpture whose image Stevens saw during transitions out of the Source Code. This prompts Stevens to ask Christina "Do you believe in fate?" As they stand in front of the mirrored sculpture, Stevens' reflection in the Cloud Gate is seen to be the image of Sean Fentress.
When the alternative-timeline Goodwin arrives for work at Nellis Air Force Base that morning, she receives the email from Stevens. While news breaks about the failed bomber on the Chicago train, the email informs Goodwin that they have changed history, and Goodwin seemingly recalls something. The email asks her to reassure this timeline's Stevens that "everything is gonna be okay". The scene cuts to Stevens who, in this timeline, is still comatose, hooked up to the neural sensors in the airtight chamber.
Output: Whose life was Colter living when he woke up on the commuter train?