PC power supply strange behaviour
The problem is most likely a failing power supply.
If you tried to power it off and then on again in fairly rapid succession (not so easy to do on newer systems), a lot of power supplies have protections which sometimes means you need to wait a fair while between restarts if you try to flip it on and off to frequently.
More likely though, one of the caps has blown, and by trying multiple times you eventually got it going - at which point the cap either was no longer needed, or the current draw was not high enough that it was a problem. (Very often the highest power draw occurs on startup)
This must be a regular tower / box / desktop computer? A few hints are
- Is the power switch dirty or going bad? Could unplug it & replace with another (or just two wires with bare ends you can "short" together yourself
- Maybe there's a light on the motherboard somewhere that lights up when "power's available but I'm still off", watch that and see if/when it's lit
- Or maybe the power supply's going bad, or the motherboard, or the extension cord & it's switch? Could swap each & check with good ones