It’s worth pointing out that the Marvel Comics history of Magneto’s helmet is a bit complicated and inconsistent. Yes, he’s been wearing it ever since his debut in “X-Men” #1 back in 1963. But what the helmet can do and why the character wears it has been in flux for decades in the pages of Marvel Comics. That said, as Comic Book Resources pointed out in 2019, various writers have touched on the helmet’s connection to telepathy over the years.
Certain incarnations even granted Magneto telepathic powers of his own. Early on, he could even project his mind into the astral plane, not unlike Doctor Strange. But even though various issues touched on the circuitry in the helmet and its relation to telepathy, it wasn’t explicitly stated that the helmet was there to outright — and simply — block telepathic powers. It’s now something that is widely accepted though. To that end, an official Marvel.com article from 2023 laid it out pretty plainly.
“To defend himself against Charles Xavier’s immense telepathic power, Magneto designed the helmet to be telepath-proof, thanks to its shape and the complex circuitry hiding under its relatively simple metal shell.”
Hayter and the other filmmakers responsible for the movie didn’t base their solution on specific issues of the comics. It was something they just came up with on the fly, and it just so happened to be based on stuff that was touched on in the comics, even if it wasn’t ever explicitly stated. But by making it a major plot element of a hit movie that started a multi-billion-dollar franchise, it became a trademark of Magneto from then on.