Since you posted that this happens when you switch on your wall receptacle I'm guessing that this is a switched receptacle. These usually will be half hot. This means that one half of the receptacle is turned on via a light switch while the other half will stay powered up all the time. If this is the case, plug the computer into the receptacle which stays on all the time. If both halves switched leave the light switch on.
Most PSUs have a standby mode which draws a quiescent voltge of 5VCD on the +5V rail. When you turn the power back on the PSU again starts drawing from the +5V rail. I suspect that restarting the PSU is responsible for the computer startup and shutdown. What is causing the startup and shutdown I can only speculate. When the power button is pressed it creates a short between the green wire and a black wire in the 24 pin PSU connector which initiates the start of the PSU. So I suspect that something is happening with the motherboard which is causing the startup and shutdown.
I would also go so far as to guess that the computer isn't actually starting up, but is only going through a voltage cycle which spins up the fans and light up the LED. But the operating system isn't opened.
I had the most disastrous situation today.
I got this weird static sound when I'm playing games and it also affected performance. So I uninstalled my audio drivers and re installed them, but nothing happened. Then I uninstalled my Nvidia graphic driver and reinstalled it, nothing happened.
I posted about audio issue on a different topic in this forum and gave up till I get some help.
Then I started to watch a movie. Suddenly a malfunction noise sound occurred and monitor stopped getting any signal. I turned off PC and restarted it. And the whole computer stating automatically thing started to happen again.
I decided to get to the root of the problem. I removed one device connected to the motherboard at one time and tried to start the PC (Not to start it automatically)
Removed the DVD drive & Hard Drive Still got the issue.
Removed the VGA card, volla ! The automatic starting thing didn't happen. Then I reconnected the VGA card I got the automatic starting issue again.
Then I did this couple more times to make sure it's the VGA. I thought the card was gone. I couldn't even check it was something else because my stupid motherboard don't have any onboard graphics.
Then I cleaned the PCI express socket on my motherboard and removed the fan and heat sink of the VGA card (There were tons of dust that card haven't been cleaned since years I think) cleaned them all and reconnected it. This time it worked ( No automatic start thing happened) but when I turned the pc on I didn't get any signal on the monitor I tried couple different times and no luck. This started to really piss me off. I removed the VGA cable from monitor cleaned the ports and reconnected it and tried again. Whoa IT WORKED !!
I turned the PC on and off couple different times without any issues. The static issue with the audio was gone too.
Now I'm absolutely sure the automatic starting and shutting down thing happened because of the VGA card but it doesn't make sense, how can a issue with the VGA card make the computer start automatically. I'm gonna starting to lose my mind if something like this happened again.
Can anyone give me a expert opinion about this ? Does this make sense to you ??
PS : I'm really bad with English it took me at least 45 minutes to write this thing. Any help is greatly appreciated !!