I also have a late 2009 mini with a fan that comes on full blast as soon as the power cable is plugged in. Apple's diagnostics will tell you it's a bad fan, but given that it's happening before you even hit the power button, that's probably not the issue (I tested mine with a known-good fan, and it did the same thing). My best guess is that the chip that regulates the voltage going to fan is fried, so instead of a variable voltage the fan is getting a full-on 18VDC.
You can measure this by opening the mini, and putting a voltmeter across the black and grey wires on the fan connector--as you're looking at the rear of the mini, with the cover off, the fan connector is near the middle of the small circuit board that hangs at the rear of the optical drive. It's the 3-wire connector with black, blue, and grey wires.
Fan control software won't fix this, because (if I'm right) the chip that the software needs to control is fried. The only "right" way to fix this is with a new logic board. That's not acceptable to me, so I went online and bought a 5 Watt, 220 Ohm resistor, cut the black wire, and put the resistor inline. That drops the fan speed to ~2600 RPM, which is slow enough to be reasonably quiet but fast enough to keep the mini cool under most circumstances.
https://www.alliedelec.com/search/pr...x?SKU=70023234