The idea for "The Night of the Doctor" came following the creation of the previous unknown incarnation of The Doctor played by
John Hurt in
The Name of the Doctor (2013).
Steven Moffat decided that he wanted to see how this Doctor came into being, with the best story idea being a direct regeneration from the Eighth Doctor, which would have added benefit of showing the end of the Eighth Doctor, which Moffat always wanted to see. Having contacted
Paul McGann, who indicated his willingness to participate, Moffat then constructed the mini-episode to serve as an additional surprise for the fans, as well as serving as an introductory piece to
The Day of the Doctor (2013).