If I remember correctly (you'd better googel it to be sure), PWM case fans use a steady 12V supply, plus a pwm signal.
I'd buy an ESP, connect a temperature sensor, put the Tasmota firmware on it and be fine. The programming is a one liner then (in that weird tasmota rules language).
If it turns out that the fan needs a pwm "chopped" 12V supply instead, then you need to add a MOSFET and 2 resistors to create that.
P.S. that module from the other comment is better.