By default, your Mac should reboot if it freezes. This is good for most of us, but that auto restart can make troubleshooting difficult for advanced users. OS X Daily shows you how to change it with a Terminal command.
You can check which behaviour your Mac is set for by typing this command into Terminal:
sudo systemsetup -getrestartfreeze
If you want to disable the restart feature, you'll need to type this in:
sudo systemsetup -setrestartfreeze off
It's worth keeping in mind that when you set this option to off, your Mac will just sit there, frozen. It won't reboot on its own, so you'll need to do it manually. However, if you've been having trouble with your Mac stealth freezing and rebooting on its own, this is one way to try and figure out what's going on.