The Combat time vs Real time

D&D 5th edition. So I was playing yesterday and our party had been wandering through tunnels and the DM said there was some noise in the distance. So one of the players illuminated an object and threw it down the winding corridor about 80 feet from where my elvish player was at (I had just stepped through a door to another room also and the DM said the player that tossed the light sees a very large blue hand on the corner of a wall).

At that point I said I wanted to cast the Leomunds Tiny Hut, which he said okay to, as other players did exploratory actions. He then came back to me a few minutes later and said it would take 10 rounds because we are in combat now, I believed we hadn’t started combat yet, we are just in a state of exploring still and aren’t aware that the creature means us harm yet. He suggested as the DM he determines how fast time moves and I wouldn’t have had time to cast the 1 minute spell, though about 3 minutes of live time and other players discussion passed before we learned anything about the creature at all, and then he said I can keep casting the spell for the next 10 combat rounds our stop the spell and burn the spell slot. All that is fine, but I was just really confused about the game mechanics at that point.

The question I had was that, this seems like a logical problem because any time you go to cast a spell how do you know if your going to waste the spell because you later find out you are in combat because a creature pops up? Are they’re any objective aspects that define when combat starts?

The reason I probably am so confused is because I am new to the game and it seems like five minutes of sitting at the table playing and one hour passes for the players in the game, but at other points it seems like time outside of combat can move very very slow. Like if a spell takes one minute to cast and your not in combat, how much time in real time does that take? Thanks