LM317 Help

No like this

12V
|
Load(Fan)
|Drain pin
|
|Digital Pin 9|----|Resistor|-------------Gate--|MOSFET|
| |
|Capacitor| |Source pin
| |
| |
| |
| |
| |
GND GND

The way you had it:-

  1. the capacitor would block the DC signal and nothing would get too the gate
  2. you would not get any more than 5V across your fan