IIRC 3 pin fans cannot be controlled with PWM through the fan itself.
If it's a four pin fan then you need a common ground between the Arduino and the fan.
If it's a 3 pin fan you can still control it via PWM, but you will need to add a transistor to switch it via PWM.