Collecting Pokémon in Pokémon GO is only half the fun. Once you've reached Level 5, it's time to get your Pokémon ready to do battle with other Pokémon. This is where Gyms come in.
Much like PokéStops, you'll find Gyms scattered across the map at predetermined locations, like historical sites, art installations, and monuments. Depending on your team affiliation (we'll get to that in a second), Gyms are where you'll either challenge other players to a fight, or train your own Pokémon to help defend the Gym from trainers from the other teams.
Gyms appear on the map as a sort of tower, with rings below the pedestal that show the Gym's prestige level. There are three types of Gyms: friendly, rival, and neutral. Friendly Gyms are affiliated with your team, rival Gyms are owned by either of the other two teams, and neutral Gyms do not belong to any faction.
You increase your own Gym's prestige by successfully "defending"—aka winning battles—against rivals, and lower an opposing Gym's prestige by beating rival teams there. If you do well enough, you can lower a rival team's prestige level to zero and take control of it.
Increasing a Gym's prestige level allows you to store more Pokémon there, where they will be trained and gain valuable experience points. Also, if you're able to successfully defend your Gym, you'll receive a special bonus every 20 hours—10 gold coins and 500 stardust per Pokémon you have housed at the Gym.
Before you can use a Gym, you'll have to join one of the three teams: Valor (red), Instinct (yellow), or Mystic (blue). You won't get to change teams after you make your pick, and there are a few options to consider before you make your choice.
First, if you have friends playing the game, you may want to join up with them, so you can choose whichever team they are already on. Second, it's a good idea to scope out the Gyms in your area and see if any team has the territory locked down. If that's the case, you can either hop on the bandwagon, or try to help one of the other teams cut into the territory.
Finally, each of the teams is represented by one of the Generation 1 legendary birds: Moltres (Valor), Zapdos (Instinct), and Aritcuno (Mystic). These legendary birds haven't surfaced in the actual game yet, but YouTube user NesstendoYT found evidence of them in the game's data, so it's a good bet that they'll appear eventually. There is speculation that you'll only be able to use whichever legendary bird corresponds to your team.