Fortunately, you can run some checks and see if that's the case. Or it will trigger when the computer is working hard, but not when you're doing more basic things.
Usually, with a hardware problem, the freezing will start out sporadically, but increase in frequency as time goes on. In some cases, it might also be your motherboard, although that's a rare occurrence. This may be a problem with your computer's hardware – your hard drive, an overheating CPU, bad memory, or a failing power supply. Maybe your computer freezes in both normal mode and Safe Mode.