There is a helpful explanation of the built-in PWM capability here: https://electronicshobbyists.com/arduino-pwm-tutorial/
Changing the Frequency involves using a different approach (or altering the built-in values associated with analogWrite).
More control is available by setting the registers for the counters associated with PWM. To alter the PWM frequency, you need to set the pre-scaler for the timer you are using. PWM can use Timer/counter 2 a 16 bit timer and Timer/counter 1 an 8 bit timer or Timer/counter 0 also 8 bit. A pre-scaler setting divides the clock frequency (16MHz for UNO) by certain preset number, so the maximum PWM frequency is limited by the clock frequency. An external clock can be used, but it can only be as fast as half the internal clock frequency (as described by Mr Nyquist's sampling theory). That's a starting point. There are heaps of web resources to help you determine what registers, pins, settings etc will get you the result you need. I think you will also find the AVR datasheet for the microcontroller useful - it is very detailed and helpful about registers and settings.
Have fun finding and implementing PWM your way. Once you've played with it, you'll find you can do almost whatever you want to within the limitations of the device!