In order to treat the teams as fairly as possible, robots from both teams execute together, in spawn order. Then all trees will run, again in spawn order. Then all bullets, in spawn order. This is important to Battlecode because it makes the turn order less predictable. Players can (and have, in the past) use knowledge about turn order to their advantage over other players when building up their Robots decision-making abilities. So, it's best that turn order be as obscure and minimally predictable as possible, and having units from both sides execute in spawn order is a good way to do that because neither team can see what order the opponents bots spawned in (for the most part).
Separately, it's important to know that bullets don't belong to either team. Bullets are neutral entities, and they will strike and deal damage to whatever unit they hit first, be that the team that fired it or their opponent.