When the wheel is removed from your bike your rotor is removed from the brake caliper, laving an empty gap between your brake pads. If you were to accidently press your brake lever, your pads comes together and stay stuck. Some of us mountain bike riders would have experienced this before.
Normally when you buy your bike it should come with the pad spacer, a thin plastic thing to keep your pads apart when the rotor is not in place. Maybe it did came with your bike but you have lost it or when you first got it you didn't know what it was for.