Many questions have been asked about why Naruto was named an Uzumaki and not a Namikaze. Given the Uzumaki clan was completely wiped out, and how endangered this peaceful clan is for being too powerful, many feel it's only logical Naruto would be given the surname of Namikaze and not the other way round.
However, there is actually a logically agreeable reason as to why the third Hokage opted to use the endangered clan as Naruto's surname.
Naruto's Father, Minato Namikaze, Made Countless Enemies, Endangering His Family
During the Third Shinobi War, before Naruto’s birth, Minato Namikaze – Naruto’s father – was notoriously feared as the Yellow Flash, a deadly ninja who single-handedly killed 1,000 shinobi in an instant, thereby winning the war for Konoha and forcing other nations to accept a peace treaty. During that period, Minato made several enemies who were willing to take any risk for an opportunity to carry out revenge against him and his family.
During the nine-tailed fox attack immediately following Naruto’s birth, Minato – the Fourth Hokage – and Kushina Uzumaki sacrificed their lives to save Konoha and their child, Naruto. Half the tailed beast was sealed inside a newly born Naruto, after which both parents died. Naruto’s care was entrusted to the Third Hokage, who, significantly, gave him the Uzumaki surname.
Uzumaki Was a Much Safer Surname For Naruto Than Namikaze
After the Uzumaki clan massacre, the few survivors were hunted down and captured by those who wanted their powers for themselves, like Orochimaru. However, that hunting gradually reduced over time until it eventually ended. Considering the number of Minato's enemies, and how ninjas from other villages were intent on killing any of his relatives, logically, it was much safer to name Naruto Uzumaki rather than Namikaze.
Neither Uzumaki nor Namikaze was an ideal surname option, considering the associated dangers. Also, Naruto was never put up for adoption, because everyone hated him as the tailed beast who killed their beloved Fourth Hokage. The Third Hokage was obviously not taking good care of him. Because there was no recorded incident of hunting down an Uzumaki, aside from the massacre, the name was safer to take, and the Third Hokage never revealed Naruto’s relationship with Minato, although he later found out about his parents. This was the only way to protect Naruto from his father’s enemies.
When Naruto eventually learned the truth about his parents, he confidently told people, despite the risks, because he was strong enough to take on anyone who dared confront him for revenge. At this point, he was free from the dangers associated with the surnames because of his powers and could talk about his parents with anyone.