After seeing a hallucination of a young woman outside his window, Sam Bell (Sam Rockwell) accidentally crashes his transport vehicle into one of the hydrogen-collecting machines. He is rescued by a man who looks like a younger version of Sam. The younger Sam is well aware that he is a clone, but older Sam claims he is the original Sam Bell. Meanwhile, the company that runs the mining operations on the moon tells Sam (via taped message, since the station can't receive a live feed) that they are sending down a team to repair the machines and return Sam to Earth.
However, the station computer GERTY (voiced by Kevin Spacey) eventually admits to older Sam that he too is a clone. GERTY healed older Sam and is hiding his presence from the company because, although it violates his corporate programming, his primary objective is to protect and assist Sam.
The two Sams soon realize that the rescue/repair team will kill both of them if they find out that they know that they are clones. After exploring the station and the area around it, they find both the room with all the Sam clones and the three signal-jamming towers that prevent live feeds from coming into the station. After travelling outside of the towers, older Sam calls his house. He discovers that his wife Tess (Dominique McElligott) has passed away, his infant daughter Eve is now a teenager (Kaya Scodelario), and the original Sam Bell is still alive on Earth.
Young Sam comes up with a plan: older Sam will be returned to Earth in a hydrogen-return rocket, while GERTY will awaken a new Sam clone and young Sam will take the place of the body in the crash (covering up any signs that the Sams knew about each other). Young Sam thinks older Sam should go back to Earth since he actually served his whole term on the station. However, older Sam realizes that he is dying (the clones only have a three-year lifespan, hence why the contract was for three years) and instead offers to swap places with young Sam.
Just before the rescue/repair team arrives, young Sam puts dying older Sam back into the transport wreck, alters the course of the three working hydrogen collectors, resets GERTY's memory so there is no trace of the two Sams being there, and takes off for Earth. As he leaves, the hyrdogen collectors are seen crashing into the jamming towers, allowing the next Sam clone to have a clean live feed of what's going on back on Earth.
Thanks Matt W!