The actor, 29, who is recognisable from Netflix's popular show Sex Education, will become the 14th Doctor on the show after Whittaker said last year that she would leave the role.
The Scottish actor, who was born in Rwanda, will be the first non-white actor to take on the role. He said he was "deeply honoured, beyond excited and of course a little bit scared".
It will happen when Russell T Davies returns to run the show in 2023, after he left in 2009.
"This role and show means so much to so many around the world, including myself, and each one of my incredibly talented predecessors has handled that unique responsibility and privilege with the utmost care," said Gatwa.
"I will endeavour my upmost to do the same."
Davies, a writer for Queer As Folk and It's A Sin, said: “The future is here and it’s Ncuti. Sometimes talent walks through the door and it’s so bright and bold and brilliant, I just stand back in awe and thank my lucky stars."
He said Gatwa "dazzled us" in his audition. "It’s an honour to work with him, and a hoot, I can’t wait to get started.”
Whittaker will be seen in another episode, which is expected to be shown in autumn. She was the first woman to take on the role continually, a move that reportedly gave the show a 10-year rating high at first, but was also controversial among more traditionalist fans who felt the character should remain male.
Gatwa has won numerous awards for his role as Eric Effiong in Sex Education, best friend to the socially awkward protagonist Otis in the sitcom about life at a British school.