The Animate Dead spell raises either a zombie or a skeleton that the caster can control with mental actions:
You decide what actions the creature will take and where it will move during its next turn, or you can issue a general command, such as to guard a particular chamber or corridor. If you issue no commands, the creature only defends itself against hostile creatures.
After 24 hours the caster loses control of the undead creature:
The creature is under your control for 24 hours, after which it stops obeying any command you've given it.
What would the creature do at the end of 24 hours if it was still with the Necromancer?
- Act as though it had no commands and only defend itself against hostile creatures
- Become a monster and wander off
- Become a monster and attack the party