Barbarian in the Playground
I've got a complicated, but detailed position when DMing. First, a little background: in the setting I run, the "soul" comes in three parts: the animus, which contains your goals, the spiritus, which contains your values, and your mentus, which contains your memory and ability to reason.
Naturally occurring undead arise when somebody dies in the process of doing something so important to them that their animus clings to their dying body, or in some cases, lives on as a ghost. (Examples: soldiers killed in a pivotal battle, knights who die before fulfilling an oath, parents killed while their children are in danger). A lingering animus brings with it a varying amount of the mentus, but never any of the spiritus. As such, this kind of undead zealously pursues a goal, but has no moral compass guiding it. (If it came back without a large part of its mentus, it may also be unreasoning--it may not even recognize the end result of its actions, and it wouldn't care anyways.) Anyways, these undead are more dangerous than evil, but they still need to be destroyed for the public safety.
On the other hand, created undead, those raised by necromancers, normally don't have an animus. They may not have a mentus either, if the necromancer didn't install one. They have no moral compass either, and if their creator/controller is negligent or malevolent, they are just as dangerous as independent undead. (The example I give to my players is a necromancer who told his legion of zombies to guard a catacomb, which was then opened years later by a construction crew. The zombies slaughtered the crew, because those were their orders. The necromancer wouldn't have wanted it and couldn't have known it would happen, but because he didn't take precautions for that sort of scenario, he was indirectly responsible for a massacre.) It's possible for a necromancer to create undead thralls ethically (e.g. by using donated bodies), but he still needs to keep a close eye on them because they will obey orders literally and stupidly.
There's a third, rarer kind of undead, the revenant: they are the product of botched or altered resurrection processes, a complete tripartite soul occupying a dead body (or bound to this plane as a ghost). In theory, there is nothing inherently evil about them; they're rare, but there are several confirmed cases of revenants adjusting to their new status and "living" fulfilling "lives" afterwards. However, when the resurrection is improperly handled and a newly-made revenant is left to fend for itself, it often goes psychotically insane from shock. (a la Frankenstein's Monster) Worse yet, evil necromancers sometimes cultivate this insanity in order to create capable undead lieutenants.
Necromancers themselves are also dangerous, because of a slippery slope that many fall prey to: they use dead people to practice their art. Some necromancers (not a majority) start out with the best of intentions, but after years of using dead people as raw materials, they start to see living people as materials as well. Governments and mages' guilds often keep an eye on necromancers, looking out for the early stages of this disassociation before it gets too severe.
TL;DR: Undead and necromancers are not so much inherently evil as they are very dangerous. People don't like them, because even when they have the best of intentions, things tend to go badly wrong around them, and when they already have evil intentions, things become downright horrific.