Asimov addressed this issue in 1942 and built several stories/books around the issue.
The Three Laws of Robotics.
https://en.wikipedia.org/wiki/Three_Laws_of_Robotics
Interestingly, the fictional date for this development was 2058.
Yabut he didn't include the Fourth Law of Robotics:
Y'see.