Controlling a 3-pin 12V 3A fan using a Raspberry Pi
You can simply use a MOSFET:







simulate this circuit &ndash; Schematic created using CircuitLab

Based on the temperature, you have to generate a PWM wave at the digital out pin. The MOSFET chosen should be able to withstand the current requirement of the fan and switch on at 3.3 V input.