I, Robot (2004)

It's the year 2035, and the community now has the help of robots. These robots have three laws integrated into their system. One, they cannot harm a human being or, through inaction, allow a human being to come to harm. Two, they must do whatever they're told by a human being as long as such orders don't conflict with law one. Three, they have to defend themselves as long as such defense doesn't conflict with laws one or two. One day, the writer of the three laws, Alfred Lanning, apparently jumps out of the tenth-floor window of U.S. Robotics. The majority of the Chicago Police Department believe that he committed suicide, but Detective Del Spooner (Smith), who hates robots, thinks he was murdered, and the number one suspect is a Nestor Class-5 robot who calls himself Sonny. However, if it was Sonny, then that means he would've had to have broken the three laws. With the help of Dr. Susan Calvin, Spooner must now discover the truth before it's too late.