I can see why you got confused but hopefully this helps.
-The ais do their own thing with different rules, they don't build farms they just attack and expand
-You can destroy the ais bases before their built and they also attack each other (strategy is to focus on defense and make sure they don't build too close)
-If you try placing a building too close to another it will move to a position it can be placed
- Buildings outside of your area won't get damaged or do whatever their supposed to do
-The farms will regain their hay when you place them on your area (the hay is there to show you it is active)