Four possible causes I can think of are:
1) Overheating
Check the if the fan spins at normal speed.
Check the fan management in the BIOS for enabled or disable and disable if necessary to test the results.
2) Bad power converter
Check the power delivery or try another power converter
3) Virus infection
Scan the system
4) Corrupted or infected i8042prt.sys keyboard/mouse driver
Scan the system
You may have to use another mouse or the touchpad to access the BIOS and to scan the system.