Here are some troubleshooting steps that may help in solving the issue.
- Start by making sure your laptop is not overheating. Open your laptop and remove the dust off the fans and apply new thermal paste on the CPU and GPU.
- Next is to do a clean install of the latest GPU driver.
- Open Device Manager and uninstall the Nvidia driver.
- Check Programs and Features as well and uninstall anything related to Nvidia.
- Next is to download and install the latest driver from the manufacturers site.
- Here's the link: http/www.geforce.com/drivers
- Reboot your laptop once the latest driver has been installed.
- After the reboot set Nvidia as the default GPU.
- Do also test your AC adapter if it's supplying the correct voltage to power the laptop.
- Try removing the battery as well and just run it using its AC adapter and see if it will still shutdown or not.
Hopefully this troubleshooting steps may help.