Minecraft wiki entry for Name_Tag, associated text: Mobs that are named using the name tag never despawn in the world, similar to tamed mobs.[1] The exceptions are wandering traders or if the mob is hostile and the difficulty is switched to "Peaceful", causing any hostile mobs or any named hostile mobs to despawn immediately.