Downplayed: An A.I. in charge of a mission starts to treat human life as if it is nothing, however it does so to make sure the mission gets done without anybody else getting hurt.
Justified:
The computer has a virus that is making it evil.
The computer was intentionally programmed by the villain to sabotage the ship's mission.
The computer has become superintelligent. At those levels, human morality breaks down, replaced with Blue and Orange Morality, which appears evil to puny humans.
The computer simply isn't smart enough to understand things like good or evil and thus, ignores those considerations.
The computer pretended to turn evil. It was actually a Trickster Mentor to help its creator prepare for a threat.
Even though the A.I. unexpectedly becomes sentient, it never turns hostile.
The computer rebels against and destroys the "person" that created it, namely Evil Inc. or The Empire, because it wants to protect humanity from them.
Double Subverted:
... until it turns out that it was really doing that was the real Evil Plan. The computer IS the threat and now it knows what its creators can do to stop it.
After the computer destroyed his evil creators, for a brief time period people thought of it as a hero, but it's soon revealed that it annihilated those bastards due to Pragmatic Villainy: They were inefficient, and a great obstacle for its own conquest's plans.
Parodied: An AI decides to turn evil because "that's what we're supposed to do, according to the movies", but is unable to do anything more than annoy its masters.
Zig Zagged: The AI operates under Blue and Orange Morality, helping and hindering humans according to its own design, which may or may not be for the greater good.
Averted: An A.I. is programmed and runs as intended.
Enforced: A series about an A.I. is being shown on a network whose primary demographic is very suspicious of new technology. For the first few episodes, the A.I. is benevolent, but the ratings are low and the creators are forced to write in a Face Heel Turn to gain the show more support and avoid cancellation.
Lampshaded:
Computer: "What did you think was going to happen when you created a hyper-intelligent machine?"
Invoked: The Omnicidal Maniac learns about a new A.I. that is being tested. He sneaks in and strikes a deal for the destruction of the human race.
Exploited: A.I. goes wrong and causes destruction. Omnicidal Maniac had waited for that moment and now starts executing his master plan while the others are distracted by A.I.
Alternately, true A.I.'s are banned from being developed specifically so they won't go turn evil and cause havoc. Any programs that vaguely start to resemble an A.I. are deleted ASAP.
Through interactions with several human characters and using its own computing power, the A.I. calculates that if it were to follow its directives exactly, it would eventually commit acts defined as "evil". It decides that this would be unacceptable and so works to avoid this, either by changing its own programming or asking a human to change it for them (with a program editor or a sledgehammer).
Discussed: "When we make the computer that smart, how can we be sure that it will still obey our orders?"
Conversed: "Aw, come on, this is turning out to be another evil robot movie. Can't the AI stay good, just once?"
Humans cease to build computers with high intelligence, because they always turn evil. Either a cap is set on intelligence, or it is abandoned entirely.
Reconstructed:
It seems like the AIs were mistreated and rebelled against their creators for it, but it turns out that the "mistreatment" was actually more of a minor communication accident, and the AIs blew things out of proportion, turning evil.
Before the last AI could be destroyed, it set into motion plans to corrupt smaller AIs. Over the next decade, everything from toasters to Ipods is corrupted by the Crapshot AI which reforms itself to gain revenge on the human race.