"The Name of the Doctor" is the 13th and final episode of Series 7 of Doctor Who. It starred Matt Smith as the Eleventh Doctor, Jenna-Loiuse Coleman as Clara Oswald, Alex Kingston as River Song, Richard Grant as The Great Intelligence, Neve McIntosh as Madame Vastra, Catrin Stewart as Jenny Flint, and Dan Starkey as Strax. This episode is pivotal and important, so my summary and analysis will include spoilers.
This episode is the culmination of many hints and mysteries that have been building through the seventh series, if not the entire run of the revival Doctor Who. At the ending of series six, we were told that the Doctor is either fated to/must not go to a place named "The Fields of Trenzalore"-- a place where he can not lie or fail to speak the truth, and where he must reveal his name. In this episode, through the device of an insane murderer in the Victorian era, we learn (second or third hand), what Trenzalore is: the place where the Doctor's grave is located. But all of this is set up as a way for The Great Intelligence, a mustache-twirling villain last scene in The Snowmen to lure The Doctor into a trap. The Doctor, Clara, the team of Vastra, Jenny and Strax, and a holographic projection of River Song (this is her first episode that chronologically takes place after Silence in the Library) all end up on Trenzalore, where the Doctor sees his final resting place: a violent battlefield where the TARDIS lays, swollen to a gigantic size by its leaking time/space field. Inside of the TARDIS lies the Doctor's "headstone": his entire twisted timeline, shown as a mass of swirling lights. The Great Intelligence has come here to get revenge on the Doctor by jumping into his timeline and undoing all the good things he has done. Clara Oswald jumps in after him, turning herself into the "impossible girl", a girl born across hundreds or thousands of lifetimes, "born to save the Doctor".
After this is resolved, we are introduced to yet another twist: in the center of the Doctor's mind/conceptual space/metaphorical something, we see different versions of the Doctor run around, but then we see one more, an incarnation that Clara, and us, did not know. The Eleventh Doctor and this strange figure then trade lines of dialog revealing that this is an incarnation of The Doctor that lost the ability to use that term, because a Time Lord's name is a title that can be lost if he fails to live up to its promise. This "Lost Doctor" is one who did so, and the episode ends as he turns towards the camera, showing the wizened face of veteran actor John Hurt.
That was a lot of summary, and even that skipped over several parts of the episode. This episode was intense and full of "all of existence is at stake" moments such as we have come to expect from Doctor Who, especially in a season finale. It is somewhat harder to judge it as a story, especially since it is treated as only an introduction to a story to be continued in the 50th anniversary special, The Day of the Doctor. The episode does become a little crowded, and the continuing plotline of River Song is perhaps treated both more briefly and more maudlinly than it deserves. The entire issue of Clara being "Born to save the Doctor" is somewhat problematic from a standpoint of feminism and storytelling. But for fans, this was shadowed out by what was a genuinely unexpected twist: the appearance of the Lost Doctor.
Whether this will be a lasting episode of interest that showed new facets of the character, or whether this will be an example of Moffat's "haha, I fooled you!" style of storytelling, is something that will probably only be known with the passage of some time.