The simple answe is yes, you can control the CPU frequency. What is possible depends on hardware and installed software.
Here is a link that gives you a solid understanding of what can be done.
https://wiki.archlinux.org/title/CPU_frequency_scaling
I know its not ubuntu, however, you can search for a ubuntu answer if you need it.