I would start with this Apple article:

If you don't want to troubleshoot it yourself, you could also do worse than:

The first step a professional would take is get out an index card and write down the times the machine shut down. Whether it went down completely or just restarted. From there, they would start to the boot chooser (hold option) and see if the machine can run that OS for 30 minutes without crashing.

At that point, you'd know if the hardware was inherently unstable or software was where to look.

Next steps: