And not just movies it's a common recurring theme in old horror stories too.
So why do dead people always want to hurt the living? My theory is that maybe they hold a jealousy against the living for having something that the dead will never have again? Maybe the dead all wish that they could go back to being alive and enjoy the same things that the living do but since that is impossible they take their anger out on the living and kill them so that they will become dead too?
Maybe the living fear the dead because they understand that the dead are angry at them for being allowed to die and that they themselves will one day be dead too?
I always feel sympathetic to the undead monsters in horror movies like ghosts, zombies, vampires, and other types of ghouls.