Here's a very nice overview
by Robert J. Sawyer of the way AI has been dealt with in science fiction since its inception.
Here's the opening:
Most fans of science fiction know Robert Wise's 1951 movie The Day the Earth Stood Still. It's the one with Klaatu, the humanoid alien who comes to Washington, D.C., accompanied by a giant robot named Gort, and it contains that famous instruction to the robot: "Klaatu Borada Nikto."
Fewer people know the short story that that movie is based on: "Farewell to the Master," written in 1941 by Harry Bates.
In both the movie and the short story, Klaatu, despite his message of peace, is shot by human beings. In the short story, the robot--here called Gnut, instead of Gort--comes to stand vigil over the body of Klaatu.
Cliff, a newspaperman who is the narrator of the story, likens the robot to a faithful dog who won't leave after his master has died. The robot manages to resurrect his master, and Cliff says to the robot, "Tell him, tell your master, that all of Earth is terribly sorry for what happened to him."
And the robot looks at Cliff and says, very gently, "You misunderstand. I am the master."
Go have a read...it's interesting stuff.