Wandering Traders and New Villagers that spawn in the world are bugged and have no AI. If you hit them they fly endlessly into the sky but if you leave them they just float.
Related issues
duplicates
Comments

I have only tried on realms

Same issue for Xbox it's super funny to just watch them ascend but yeah no AI on realms but there all good on creative single player

Yeah I have seen quite a few videos on the minecraft subreddit of this happening. Its happening with both old villagers, and wandering traders. Its exactly as described in the post.
Thank you for your report!
We're actually already tracking this issue at MCPE-43464, so we will resolve and link this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki
Is this only happening in a Realm, or does it occur in new local worlds too?