Usually, the DM decides when rounds start, and usually this is at the beginning of actual combat. I don't see any particular reason you couldn't start dodging right away — and, in fact, telling the DM that you want to do this would usually start the beginning of combat rounds. (With the DM saying "okay then, roll initiative").
You don't have to do it this way, though, and in fact, I think the normal approach would be to use the Ready action. This is technically also something you do in combat rounds, but in every D&D game I've seen, it's exactly what people do when they want to be prepared for something before combat has started per se.
Here, you say "I'm going to ready to dodge when I see a creature on the other side of that door". This works out rationally, because Dodge requires you to be able to see the attacker to work, so there's really no point in having it "active" before that.
On the other hand, Dodge reflects a greater level of alertness all around (as modeled by advantage on Dex saves), and I think it's equally reasonable to say "I'm going to walk into that room on high alert — effectively, I'm taking the dodge action as I go in."
Either way, of course, prevents you from making an attack on your first round, even if there's obviously an enemy there to engage.