In-game considerations:
Mythology source
-The dead walking is rarely a good thing in pretty much any mythology. They are a sign that something is very wrong with the world. However, one oddity is that the walking dead are often placed in the victim role as well, something the game aspect of things don't reflect much. They are also bringers of wisdom and warning, assuming you weren't the one who got on their bad side.
-Abrahamic faiths further cemented this by wiping out/demonizing the native myths, which killed off whats left of the beneficent dead and linked them strongly to demons. Morality in D&D is related to Abrahamic morality(which makes sense in a way), so everything follows.
The Smiting Issue
-As the traditional foe of the undead, clerics and paladins were determined to be super effective against the undead. As their abilities were often alignment based, mook undead tended to be immune.
-Undead are very directly opposite archetypical clerics really. They inflict a large variety of status effects which clerics can/must fix.
-This winds up with the 3E issue of even mindless undead being evil, to allow Good divine casters to be even more effective on them.
In The Fluff
-Natural undeath arises from generally, horrible deaths. The creature that results is not going to be a stable, well adjusted being for the most part even before they add the hungers and alignment changes.
-Curse-origin undeath are likewise, intended as a punishment. As most of these punishments are directed to evil individuals to begin with, it only made things worse.
-Artificial undead were in the fluff, devised by Orcus, a demon. It is reasonable to expect then, that the spells to create them are evil, after all he made them that way, possibly drawing upon his power to function. Meanwhile, as the forces of Good are reluctant to draft people who are unable to give consent, and thus do not sponsor any equivalent magic on a large scale.
-Self-inflicted undeath meanwhile is a mixed bag. Most of these stem from selfish intent, and requires evil acts to attain without divine sponsorship. They're rare though, and thus don't really feature into common perceptions.
Why NOT hate
-Sentient undead, except at the lowest end, are actually more compelling and attractive than they were in life as a result of raised charisma scores.
-Undead without feeding habits make very good allies and servants. Even evil can have friends, which makes it a good idea to befriend one if you have no conflicting interests.
Meta-game considerations:
Undead are by default, easy Acceptable Enemies.
-They are already dead, so you can't be too wrong to kill them.
-Low end undead(zombies, skeletons, ghouls) are usually disgusting, they combine the natural reaction to decomposition with the effect of being ALMOST human(unlike say, a tree, which is clearly not human and never was to begin with) to generate a visceral 'wrongness' reaction. As humans we know lots of the stuff they have outside should be firmly inside.
-Contagious undead(ghouls, vampires, wights) add the fear of corruption and disease to the mix.
-Feeding undead puts people firmly on the prey side, which adds another layer of primal unease. Nobody likes being on the menu.
-They make easy recurring enemies. If they can beat death once, they can do it again.
They last forever.
-Undead with return conditions(liches, ghosts and even vampires(to an extent)) don't expire easily. When players can solve most problems with a hefty dose of overkill, it just plain won't stick.
-They can be extremely ancient, yet humanoid enough to be relatable, unlike dragons and Outsiders. Age also means power, partly from endless training for the sentients, which makes them a parallel for player competencies.
-They can stand guard indefinitely, often over their own belongings. When PCs break into tombs to take their stuff they can respond to the home invasion none the worse for the passage of time.
-They're for the most part, resistant to the cheap takedown methods due to their buffet of immunities. So they make good boss-types, a huge wall of hp lets them last as long as you need them to.
They make a good story.
-Especially for unwilling undead, the process involves a nasty death at some point. This can evoke empathy.
-Some undead can pass for human, vampires and liches do not necessarily have to rot. They make a handy Enemy Among Us.