As saying goes, "No Man is an Island", you need to join a team so that you can challenge other teams and can participate in a battle. By the time you join a particular team, you obtain a potential and is able to designate a Pokemon you captured to an Open Gym pokemon full map locations or you can assign it to a Gym where a Pokemon is assigned by a certain team member. The Gyms can also be found at actual places around the globe which is just the same with PokeStops. Only a single Pokemon can be assigned at a selected Gym. That is why as a team you have to work together in order to make your defense formidable.
If an opponent comes, and claimed a Gym, you'll be able to challenge this team by using the Pokemon you have captured and overcome the defending Pokemon. You see, team battles are also fun and at the same time challenging and difficult. You can choose what Pokemon will have to face your rival team. Every Pokemon possesses two types of attacks, while fighting, it can also avoid its opponent's attacks by swiping your touchscreen to either left or right. If luckily your chosen Pokemon wins the battle, the Gym's status will gradually decreases, and when the Gym's prestige will be at zero level, that's the time you or another team member can take over and take control of the Gym by assigning a Pokemon to it.