Aux Fan behaving very oddly

What is going on here?

I have a 2010 S5 4.2 V8 - the aux fan runs for 20 minutes on end after shutting off the car when it’s 50 degrees farenheit out, no A/C was used, and the engine never gets hotter than 102 celcius while operating. It’s left me with a flat battery a couple of times. Now it gets interesting. When I press the unlock button on the key fob, or pop the trunk with the key fob after the car has been sitting for a half hour, - THE FAN WILL KICK ON, and run for 5 minutes!