In a previous car this occurred to me when the actuating flap for the heater box got stuck open.
I did a google search to see if it affected the e53 and found this link
Heater control actuator flap problem help - Bimmerfest - BMW Forums
Here is a link to the valve if you're trying to sight it
Heater Valve - E39, X5 - Turner Motorsport
That smell you're getting, e39's are notorious for it and I'm pretty sure the e53 shares the same system. It's referred to 'gym sock' smell. It comes from mildew growing inside the condensor, just a bad design. Can be quick fixed by spraying a special deoderizer through the vents - but the proper fix is to get access to the condenser and spray it directly on there. In the e39 that involved drilling a hole to get inside the box.