Profound Apologies, jackaustin25, that earlier post for iPhone would be confusing.
(Another poster was asking exactly same same info., but about iPhone.)
Wondering which Mac model,, and which Mac OS version you are using.
You might need to back up your data, ensure Mac is fully charged, and to update the software version.
or
You might want to see if one of these articles from Apple Support helps troubleshoot:
If your Mac restarted because of a problem – Apple Support
If your Mac sleeps or wakes unexpectedly – Apple Support
If an app freezes or quits unexpectedly on Mac – Apple Support
Or if the shutdown occurs frequently:
How to use safe mode on your Mac - Apple Support
______________________________________________________________________
Wondering if you have enough memory / storage on your Mac (at least 50 Gb free) for your Operating System to work smoothly.
How to View memory usage in Activity Monitor on Mac – Apple Support
How to check, and /or free up storage space on your Mac.
Free up storage space on your Mac - Apple Support
As you can see, the shutdown cause could be from quite a variety of possibilities. They are likely more!
If needed:
You may want to check things out with Apple Support:
There is a "Get Support" link to the Apple Mac Support Team at the bottom of their webpage,
or you can download and use the support app from the same web-page (link below)
or
Apple phone numbers around the world
Contact Apple for support and service - Apple Support
All the best :-)