It was the charger. It was faulty and turning on and off at random intervals, and for some reason the computer decided to limit the CPU. Buying a new charger (from the manufacturer) fixed it completely.
I just partially solved this on my computer, a Lenovo which was constantly stuck at 0.39GHz, based on this answer on the HP forums:
So, I think I've found a solution to this and it doesn't really make any sense.
In Windows 10, go to Device Manager, find the section titled Firmware, expand it and right click "System Firmware" then click "Update Drivers" select "Search Automatically Online" and let Windows do it's thing, it will take a couple of minutes, it should update the firmware of the machine.
In my case it was called something like "Lenovo System Firmware 1.17", I updated it, restarted the computer, and then kept receiving a warning to restart to finish installing the new driver. I followed this answer on the Miscrosoft forums, which fixed the issue:
As this error message indicates a failure in the hardware, we suggest that you run the hardware troubleshooter. To do this, kindly follow these steps:
- Press Windows and type "troubleshoot".
- Select Troubleshooting and click Hardware and Devices.
- Follow the on-screen instructions to run the troubleshooter.
- Restart your computer and see if it will now work.
Let us know the result of the troubleshooter.
After restarting, my computer is back to its old speeds for the most part. Every so often it goes back to 0.39GHz, but unplugging and plugging back in solves the issue temporarily. I'm still looking for a long-term fix.