iron golems spawned by the player leaves the village and does not try to protect it at all.
Linked issues
Comments 2
Thank you for your report!
We're actually already tracking this issue at MCPE-46240, so I will resolve and link this ticket as a duplicate.
That ticket has already been resolved as working as intended, which means this is not considered a bug and won't be fixed. Please do not leave a comment on the linked ticket.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – ✍️ Feedback and Suggestions – 📖 Game Wiki
If you want the iron golem to stay, you should build a wall around your village. Also, the golem will only protect villagers if your village has more than 10 villagers, and more than 21 doors, in which case a dedicated iron golem will spawn, meaning that the iron golem you spawn is dedicated to you.