It sounds as your CPU is overheating. You will need to carefully clean out the dust in the case, especially around the cooling fins for the CPU. I use a small artist's brush and hold a vacuum cleaner nozzle near by. Just need to be careful.
Hands-on: Samsung Galaxy S8 review