There are many things that can cause a computer to shut down. If your computer stops responding, it's most often an issue in your operating system's software.
Operating systems consist of millions of lines of programming code. Inevitably, the code contains weaknesses. Sometimes when you open a series of programs you trigger something in the code that makes the operating system go into an infinite loop where it executes the same instructions over and over, making it seem like the computer is frozen.
And then there's always the possibility that you have too many programs open. When a bunch of programs are competing for the same memory resources, sometimes memory gets used up when the computer has to switch back and forth quickly between programs.
Luckily, in most circumstances, those are problems are fairly easy to fix.
Read More:
Shields, Clay. "Why do computers crash?" Scientific American. January 02, 2003. Accessed February 06, 2017.