When you have that problem --- runs slow, and seems hot, it's likely there is some software process that is the culprit.
You can check in your Activity Monitor. Make sure it is set to show All Processes, and not just Your Processes.
Look in the CPU tab first. You can sort the list by %CPU (Each time you click on the menu header in the %CPU block, the list will reverse. You want the highest numbers at the top )
What are the top 5 processes, and the percentage numbers listed?
Best time to look at this is at the time that you have the problem...
You may also wish to download the free diagnostic program EntreCheck which may be helpful for the Gurus to help you diagnose what is going on if it is not obvious that Activity Monitor shows what applications are eating CPU/RAM.
Do you delete all useless apps and files regularly? By the way, there are plenty of hidden files that can make your Mac slow. Another reason can be too many background programs. Check this article - https://makemacfast.com/
take a check at your activity monitor. it will help you know the processing of each running application. it keeps an account of cpu and memory usage.
also, keep omitting your caches and temporary files. it will fasten your system.