I had an idea for a fanfic where essentially the main character of my story replaces the main character of a video game. If I hypothetically decided I wanted to post it somewhere, could that hurt my chances of publishing my original story?
As far as I know, no I can't imagine it would hurt your chances unless it was either a) shockingly terrible or b) so hugely offensive that the publisher didn't want anything to do with anyone who would write something like that. So you're probably fine in that regard. However potential readers could be more of a problem. If they see your book on the shelf (if it were to get published, of course) and they want to research you before they buy, and they find that fanfic under your name, they'll judge whether or not they buy your book off what they think of that example.
Fair points, but isn't most fanfic uploaded under user names that wouldn't necessarily be associated with later published work? That might be the way to tackle that. Something to consider, especially if you're talking about a longer piece, or something that could eventually be turned into an entire book: Write your fanfic, or at least start it as fanfic, and once you get going, change enough of it to make it completely your own. The Fifty Shades series started as Twilight fanfic. Fact. https://en.wikipedia.org/wiki/Fifty_Shades_of_Grey#Background_and_publication
I wrote fanfiction exclusively for three years before writing my first original novel. Granted, it was under a completely different pseudonym, but it didn't cause any problems with my being accepted by a publisher. I don't think they were aware of it when they accepted the MS, but they definitely knew as we went through the publication process, and it hasn't stopped them from wanting to publish my work at all.