Can I use my legal name as the protagonist if I'm pitching my book to traditional publishers under a pen name? Would I be rejected for doing this?
Besides the real world repercussions Arcanist Lupus has mentioned, there are story-internal considerations to be made.
In fiction, names carry meaning and therefore certain names fit certain characters better than others. For example, in the Lord of the Rings, if the hobbit had been called Gandalf and the wizard's name had been Frodo, the names wouldn't have emphasized their personalities and role in the story in the way they do, and calling the elf John Smith would have been totally unfitting.
But even in stories set in the real world, readers imagine a different person when she's called Rose than when her name is Freedom or Alaska. Names of fictional characters have to fit the genre, and because certain sounds and names evoke certain personalities they are part of the description of the character. For that reason, publishers often require that the names of characters are changed.
So when you name your characters, you should consider which names best fit the type of person you are writing. Your own name might fit, or it might not.
Finally, when you feel that your character should carry your name, you may be making a mistake common to beginning writers: you do not write fiction, but a daydream.
Instead of coming up with a story interesting to readers and developing characters for that story, you may be dreaming yourself into a situation you find titillating (such as an erotic or power fantasy) which may not have much appeal beyond self-gratification.
So make sure you understand what you're doing. We all write stories that we enjoy, but to write good characters there has to be some processing and abstraction that usually doesn't happen when you put yourself in your story, resulting in characters that are both too complex to be interesting and too unidimensional and "obsessed" to be likeable.
Real peole don't make good fictional characters. Good fictional characters are always a bit stereotypical and exemplary.
It seems unlikely that the story would be rejected outright based on that, but it would definitely raise some eyebrows.
A story and its characters (particularly its protagonists) are closely entwined. Each shapes the other. But a protagonist that is meant to represent a real person interferes with that dynamic. It anchors that character to a world outside the story, and the story warps around this anchor.
You can, of course, base characters on real world people. Authors do this all the time. But you must divorce the character from its initial inspiration if you want them to be able to grow properly. Using the name of a character's inspiration as the character's name is a red flag that the author has not properly separated the two.
There are considerations beyond publisher reaction
If your book were to be published and achieve any amount of fame (which is presumably your goal) it is certain that your real name will eventually be discovered and associated with the novel. It's said that there's no such thing as bad publicity, but the attention you get for this is unlikely to be positive.
I've actually seen this happen in a piece of web fiction. It was part of a shared universe, and one of the authors chose to use a character with their same name as their protagonist. The character received a great deal of vitriol from a section of the readership who saw the character as an author insert. There were, of course, complicating factors (there always are), but a significant portion of the negative reader response could likely have been avoided had the author simply chosen a different name for the character.
Unless your protagonist's name is vital to the story, giving them your name seems like a great deal of risk for very little gain.
It's pretty easy to change a name during editing using find and replace. Write your story using whichever name is most comfortable to write with, and then change it later.
Why do you want to do this?
Any time a writer says he wants to do something unusual, my first question is, Why? If you have a good reason, if this unusual device highlights some important element of the plot or some such, than great, go for it. But if your reason is just "I think it would be cool to do something weird just for the sake of doing something weird" ... don't. The novelty of weirdness for weirdness sake tends to rub off very quickly, and then it just becomes a distracting or annoying gimmick.
In this case, making yourself the main character in a novel sounds like self-aggrandizement or childish play acting. "I want to pretend that I'm a super-hero!" or "I want everyone who reads this story to be amazed at what an extraordinary person I am". If that's what you're thinking, I'd just say, don't. If you have some good reason for it ... but I'm hard pressed to think of a good reason. Even if the story is a fictionalized account of your own life, you're better to just invent a character name.
I read a book by Philip Jose Farmer once that had a character named Peter Jairus Frigate who sounded suspiciously like Philip Jose Farmer. Note the same initials. I found it cloying and distracting.
On the other hand, Robert Heinlein has a book which makes a brief mention that the main character lives "across the street from the hermit, the original Hermit of Hollywood", and then he goes on with the story. I read once that Heinlein was sometimes called the "Hermit of Hollywood", so he was referring to himself. For a quick one-liner like that, okay, cute, a little joke between the author and his fans. Or like the way Hitchcock would often have a brief scene in his movies where you see Hitchcock standing at a bus stop or walking by. Again, cute little joke. But in neither case did he make himself a "real" character in the story.
There's nothing stopping you : Gene Brewer did it in the K-PAX series, but a publisher - and particularly a traditional publisher - is likely to want to know why you did that.
If there's a good reason, rejection is less likely. But if the reason is something like "that way it looks like the protagonist really wrote this and so all these things must have really happened", it could just end up looking like a cheap gimmick (I'm looking at you, Brewer...).
You're right to think that a publisher might question this. It's worth making sure you have a good answer.
You could, but shouldn't be surprised if people think it is autobiography or an indication of a personality defect. If you don't want to carry the baggage, then choose another name. They don't matter much in the end. Like everyone else I fail to see what your story gains. Maybe an Easter egg? But also a lot of questions during the working process that get in the way of your goal: publishing a book.
People may also think you are trying to break the 4th wall; and there's only one story I know of that has successfully done that with abandon, and it does not involve inserting it's creator (Deadpool). Spoiler! Steven King intentionally breaks the fourth wall and writes a version of himself into the story, and many readers call this the last straw of his missteps in that series. (And he's written a lot of books and had strength of a personality cult; still failed in some regards)
The answer is that you can, but should not without an extraordinary reason. If you think you have that reason, you are probably wrong; and since you are asking you likely know this deep down. So here: you have permission to tell yourself no.