Free Will Hunting
Futurama Season 9 Episode 9 (08/08/12)
After a spree of bad decisions that leads Bender back to court, he gets a shock to his system: he doesn't have free will, so he couldn't be guilty of his crimes because he had no way to make his own decision. While this gets him acquitted, he is lead on a soul-searching journey to ponder his existence, knowing that his decisions are really just based on lines of code.
However, he discovers that a "free will unit" to give robots the ability to make their own decisions exists, and he searches for it. It turns out that Professor Farnsworth created one when he worked for Mom, but he hid it because it could lead to robots wanting to kill humans. Bender threatens to kill Prof. Farnsworth for the free will unit, but he cannot shoot him or even pick it up due to his programming. However, Prof. Farnsworth feels bad for Bender, and installs it in him. He then gets shot by Bender, who is found guilty for attempted murder. He celebrates, as he knows he made the decision to commit the crime.