PC freezing when playing online game

I have an issue while playing online games on my PC. When I start the game, my PC frozes and I have to manually turn it off in order for me to get it working. When I use it for other things such as streaming and watching videos or general use, this does not happen. Also the fan gets loud when the PC freezes. Can I get help please?
