The former Bayern Munich, RB Leipzig and Hoffenheim boss succeeds Hansi Flick, who was sacked earlier in September just nine months out from the start of a European Championship on home soil after a dire run of form.
Now Nagelsmann, 36, will be tasked with turning around his nation’s fortunes and leading them into Euro 2024, having signed an initial contract that runs until the end of the tournament after being out of work since being replaced as Bayern head coach by Thomas Tuchel in March.
He had previously been linked with the vacant managerial jobs at Chelsea, Tottenham and Paris Saint-Germain.
Nagelsmann's playing career was cut short at the age of 20 by injury and he moved into coaching, with his big break coming at Hoffenheim in 2015. He moved on to Leipzig before joining Bayern in 2021.
The DFB said Nagelsmann had been its "unanimous choice" to replace Flick, who was sacked earlier this month with the national team having lost four of their last five matches, including a 4-1 friendly defeat by Japan.
They also exited at the group stage in Qatar last winter for the second World Cup running.
Nagelsmann said: "We have a European Championship in our own country and that's something special - something that happens every few decades.
"I have a great desire to to take on this challenge. We will be a close-knit group next year."
His first matches in charge will be against two of the 2026 World Cup co-hosts, the United States and Mexico, next month. Germany are also due to take on Austria in November.
Additional reporting by the Press Association.