Whenever I am far away from my unloaded chunks where my farm animals are, many of them sometimes start to despawn that only a few ones remain. That happens with chickens, cows, sheep and pigs. My farm-fence gates were always closed. It is happening on my Android Phone Huawei Mate 20 Lite with 4 GB RAM.
Related issues
Comments

Thank you for your report!
We're tracking this issue in MCPE-21416, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
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 – 📧 Mojang Support – ✍️ Feedback and Suggestions – 📖 Game Wiki