Controlling a CPU/case fan with GPIO PWM based on CPU temperature

In my case, I’ve got this is working in a Raspberry Pi 3, but the fan when running on low values, like 70 or 80, even 170 is causing a buzzing noise. When I set it to 255 I can’t hear the noise that much, but I think is masked.
I used a BC337 and a resistor to connect the fan, and I’m using the pin 2.