Hi,
Please do try these troubleshooting steps that may help.
- Start by doing a test with the AC adapter.
- Remove the battery and connect it directly to it's AC adapter and observe if it will still shutdown or not.
- If the laptop will not shutdown if directly connected to the AC adapter that could mean that the problem is with the battery.
- But if the laptop will still shutdown while directly to its AC adapter try a different AC adapter first that has the same voltage and see if the same problem will persist or not. If it will still shutdown by itself that could mean that the problem is inside the motherboard.
- I would suggest opening the laptop and remove the dust off the fans using compressed air and apply new thermal paste on the CPU and GPU.
- Another test would be to load the laptop into BIOS and see if it will still shutdown or not because if it will still shutdown that could mean that it's overheating.