I think that, sometimes at least, alignment may play a role in an attack. Creatures that are Chaotic Evil, for instance, are just abiding by thier very nature to kill maim and slaughter.
You are right tho, many times a published adventure does not follow any kind of logic in these instances...