WanderingWind
Mecklemore Is My Favorite Wrapper
It's random but more likely if your defense is poor in comparison to the sum of your food and water rating. It also seems to not matter if you build walls, sometimes enemies will be dumped into the middle of settlements. Can someone confirm though? Is it possible to build walls to keep the fight outside of the settlement?
I can confirm that walls do nothing besides look cool. Enemies can and will spawn inside of the settlements themselves regardless of walls.