PWM Fan control with ESP32

If you are powering the esp from a different source than the fan then yes. You need a common ground as a reference for the pwm signal.