Macbook Pro very hot
I bought my macbook pro in August 2015. It has been running fine, and I've installed all updates as they came out (so I have OS X 10.11). This morning, I plugged in my macbook and allowed it to charge fully. I unplugged it around 2 PM and put it in my bag. I didn't use it the entire day. Around midnight, I pulled it out of my bag and the computer was extremely hot, to the point that it was uncomfortable to hold. I hadn't left my bag near a heating vent or anything like that, and the only part of the bag that was warm was the laptop compartment. I opened the computer, and it was unresponsive. I closed it and cooled it to something more like room temperature, then did a hard restart (holding the power button). It turned on, restarted fine, and turned out to have a battery of 77%. I don't seem to have lost any data, even a browser tab.
I had Safari open with a few tabs, but running nothing more complex than a flash game. Three or so documents in Pages and Preview. I had opened Steam briefly, but that hasn't given me issue in the past. Any ideas on what caused this or how to prevent it from happening again?
MacBook Pro, OS X El Capitan (10.11)