So you bought a HP laptop. Not good. Sorry but I have personal bad experience with HP laptops. Especially with overheating.
First. You can try cleaning out the fan with some compressed air. You may be lucky.
Second. Is the laptop still under warranty? Then take it back and make them clean up the mess.
Third. You will probably need to disassemble your laptop to get to the fan and clean it up. Chances are that your ventilation has becomed clogged with dust and hairs preventing it to dispose the heat of your CPU and GPU. Since this is a HP laptop you have a great deal of work ahead of you if it's the first time you try to take i apart. Look for some youtube videos on how to take it apart. Go to HP's site and download the Service and Maintenaince Manual: http://h10025.www1.hp.com/ewfrf/wc/manualCategory?cc=us&lc=en&dlc=en&tmp_geoLoc=true&document=&product=4188658
It will give you a complete guide how to dissasemble the computer.
Get to the heatsink. Open the fan. Get all f the dust out. Remember to look inside and make sure to get it all out. Re-amount the heatink with thermal paste. Good luck
I too had heat issues with my HP. It was a HP Envy, purchased two years ago. I needed a cooling pad underneath. Eventually the monitor had problems. Lesson was: cool it with extra fans and don't game to long at a time.
As for fan, open the bottom of the HP and clean the fans with compressed air.