I would still connect it to D9 for 12v and use that as a master on/off switch
the PWM you connect to a PWM pin (5v ) use the pins on the servo connector say D4 and the Gnd or D5 or D6 or D11.
Change your firmware so the fan pin is this PWM pin then software that uses fan on/off still works.
you will need M42 P9 S255 for power on
and M42 P9 S0 for power off
Put in start and end gcodes or equivalent