It may even be the PSU - old PSUs gradually lose their capacity - it may be enough to start the system, but not quite enough to run it.
Otherwise - it's unlikely to be the Hard Drive (as it restarts even during th POST. Same with Virus.
It may be a fan failure - have a look inside, notably at the CPU fan.
It may be bad connections on plug-in boards and/or RAM and Processor.
Failing the above best guess is RAM or Motherboard.
The only way to troubleshoot is by substitution.