Given the fact that Stan Lee was the writer and co-creator across so many of the titles and characters at the formative years of Marvel Comics, it was a way for him to make it easier to remember them when writing and fleshing out the scripts.
Here's a snippet of a Q&A with Stan Lee around the premier of Spider-Man 2 that explains it all:
And we can chalk up all the alliterative names in the Marvel universe to Stan Lee's one failing. "It would be hard for you to believe this, because I seem so perfect: I have the worst memory in the world," Stan said. "So I finally figured out, if I could give somebody a name, where the last name and the first name begin with the same letter, like Peter Parker, Bruce Banner, Matt Murdock, then if I could remember one name, it gave me a clue what the other one was, I knew it would begin with the same letter."
If you want to look at DC Comics, and in particular Superman, it may have been due to a personal romantic connection of Joe Shuster, one of Superman's co-creators:
What is the L. L. connection for Superman?
A remarkably large number of characters in the comics have the initials L. L. Most notable are Lex Luthor, Lois Lane, Lana Lang, and Lori Lemaris. A rumor says that these names were chosen because Joe Shuster's first girlfriend had the initials L. L.