The Three Laws Of Robotics were envisioned by Isaac Asimov.
They were founding principles of robot Ai designed to protect humans, and the robots themselves.
These laws were built into the very equations and circuitry that the AI ran upon - so in most cases the AI had no way to circumvent them.
While being a great founding principle - they were not infallible.
There is one story where a robot must choose between a human holding a gun and a human the gun was aiming at. If the robot didnt act - the other human would surely die - so it must harm the human with the gun.
Another very famous tale is the Bicentennial Man where a robot is ordered by humans to take itself apart.
Anyone interested in the psychological and other aspects of the interplay of these laws and humans should read I Robot, Robot Visions, Robot Dreams and other such works by Isaac Asimov.
Time to build your own robot! Using a Raspberry Pi with parts and some time, you can use my book to learn how to make and program a robot with automatic behaviours.