David has discovered that, rather than being a normal human who achieved his childhood dream of playing his hero, the Doctor, on television, he actually is the Doctor turned human and living in an alternate universe. Knowing that the future Doctor already exists, he realises he must sacrifice his life so that the Doctor returns. As he is about to do so, the TARDIS quakes, throwing him off his feet, and the pocket watch that holds the Doctor’s life force bounds out of the time capsule’s door. David, Amy, and Rory chase after it and find themselves in a temple at the swordpoints of the temple guards, who confiscate the watch and take the humans prisoner, whilst the TARDIS inexplicably dematerialises.
After imprisoning Amy and David, the ranking priest of the temple questions Rory, who begs for the watch back, telling him that the three will happily leave if they can retrieve the device. The temple's expert in magical artefacts examines the watch and then opens it. When the Doctor's life force begins to emerge, one of the guards smashes the watch and the energy sinks into the ground. The guards then imprison Rory with his friends. He discovers that the energy released from the watch sought David out and, because the watch was damaged partway through its release, transformed David partially into a Time Lord, though he retained his identity. David wrestles with coping with his new consciousness, altered body, and awakened time sense.
Some time after being imprisoned, another prisoner, named Minlay, is brought to the dungeon, an adherent to the god of the temple who has been accused of blasphemy. She explains that the planet, Cherel, is ruled by a god named Orsanal who has lived for over nine hundred years by creating a new young body for himself every year. As a cleric of the god, Minlay has seen how the god works and, with the arrival of these strange people who appeared out of nowhere and are not Cherellan, questioned whether Orsanal might be one of them. Questioning the god is blasphemy, and thus Minlay was sentenced to execution. Upon hearing this, Amy, feeling responsible for the woman's death, wants to appeal for mercy and butts heads with David, who, in considering the situation from a Time Lord point of view, insists that they cannot interfere with the planet's society and laws.
The three are soon brought before Orsanal himself, who excuses his servants then prostrates himself in front of Amy, mistaking her for a Time Lady. When she explains that she's not who he thinks she is, he explains that he just a normal, mortal Cherellan, but a Time Lady - David deduces she was the Rani - gave him an experimental device that replicated his body from biodata, allowing him to create the myth that he is immortal, and he used this to strengthen his people's faith and end a disastrous holy war. He has been using this to keep the peace for nine hundred years, though he admits that he simply does what he thinks is right and hopes for the best. When David, for Amy, requests clemency for Minlay, Orsanal refuses, willing to sacrifice the life of the woman to retain the respect and faith of his people.
Once the three convince Orsanal that they're not Time Lords and that the Doctor will not take away the replication device, Orsanal returns the watch to David. The TARDIS lands, having been prevented from doing so earlier by the paradox caused by the loss of the watch, and the Doctor appears. He informs David that the TARDIS willfully prevented the opening of the watch and brought them to Cherel, where the replication device could be used to create a body for David while the original is restored to the Doctor. David realises that this body would be mostly Time Lord and only partly human, and thus he would be doomed to a life of a thousand years without a people or a home, but he is unable to take the second option, which is to sacrifice his life and become the Doctor again. He submits to the procedure and he acquires his own life and body whilst his Doctor returns to the original body.
After departing from Cherel, the bowtie Doctor asks David what he wants to do with his life, offering to take him on as a companion and teach him how to be a Time Lord. David is about to agree to this when the pinstripe Doctor makes the same offer, to save his future self from having to take on another person when he already has two companions and is moving on with his life, whilst he has an empty TARDIS. David accepts this, to become a companion of his Doctor, and the earlier TARDIS takes on the paradox circuit to maintain the original paradox that started all of this in the first place.
A number of months later, David invites Catherine Tate to dinner at his house in Cardiff. He reveals to her all that has happened to him, explaining that he wanted to finish filming his episodes and close off his former life, but that he's returning to the other universe to pursue his new life as a Time Lord. He admits that he chose to confide in her because he wanted someone in the universe he grew up in to know what had happened to him and to remember him as he was. During their conversation, she reminds him of something that he knows that the Doctor doesn't, that the Doctor would want to know and make right. He reveals to the Doctor that Jenny is still alive, and together, they seek her out and bring her home to the TARDIS, so that the Doctor can train the last two young Time Lords.