This seems like your computer is protecting itself from a certain component over heating. I'm glad you finally decided to ask a question about this lmao, but 2 months of powering down due to high temperatures is pretty damaging to your computer. Do you have any software that tells you your computer temps? If you're feeling ballsy do a load test or GPU load test and see if it shuts down during.
Also can you give more details on the computer? How old is it and does your CPU have any thermal paste on it? Could be a bunch of other things by the way, but the way you describe it seems like an overheating issue.