This question already has an answer here:
On the seventh episode of Last Week Tonight John Oliver interviews Stephen Hawking about his warning against the dangers of AI. Here's part of the exchange:
Artificial intelligence could be a real danger in the not-too-distant future. It could design improvements to itself and out-smart us all.
I know you're trying to get people to be cautious there, but why should I not be excited about fighting a robot?
You would lose.
Okay, for a start we don't know that. We don't know that for sure. 'Cause what could a robot do that I couldn't then fight back by simply unplugging him?
There's a story that scientists built an intelligent computer. The first question they asked it was: "Is there a God?" The computer replies: "There is now." And a bolt of lightning struck the plug so it couldn't be turned off.
The story he referenced immediately struck me as familiar. I believe other story components include that the AI was built in an isolated, possibly mountaineous, location and that it killed all but one of the scientists present when it achieved singularity. It managed this by somehow generating energy bursts which prevented its shut-down.