@leipa, Niklas, Run your virus/malware protection to ensure you have not been infected. Check and update you Bios and drivers. Try a thorough cleaning of all vents/fan/board using canned compressed air. Try system restore to an earlier date when computer was running better. Use your computer on a hard surface free of dust, carpet, table clothes, bedding etc is the worst for attracting dust and restricting cooling. Try disabling the Quick Launch from the start up if on your computer, as some forums say it solved their issue of over heat/shut down. Some laptops run cooler when not plugged in, try running on battery only. You could perhaps add/purchase a cooling pad for laptop to sit on, may help.
https://support.hp.com/us-en/document/c01657439
https://support.hp.com/us-en/document/c00033108