In Pokemon GO, Pokemon Gyms are team bases where Pokemon Trainers leave their Pokemon to defend and battle opposing teams. The three teams in Pokemon GO are Team Mystic, Team Instinct, and Team Valor. Up to six Pokemon can defend a Pokemon Gym, but only one Pokemon per Trainer can be chosen to defend a Gym.
Pokemon Gyms also have PokeStops attached to them that can be spun every five minutes. The newer Pokemon EX Raid Gyms will also house Raid Bosses at specific times throughout the day.
Pokemon Trainers from friendly teams can feed berries to the Pokemon defending the Gym. Feeding berries will restore the health of the Pokemon, and will give the Trainer XP and Stardust. Trainers from the same team will also receive a bonus when spinning the PokeStop attached to the Gym.
Trainers from opposing teams can battle the Pokemon defending the Gym. The Pokemon defending the Gym will be controlled by AI, but the Pokemon challenging the Gym are controlled by their Trainers. Up to six Pokemon can be chosen for a challenger’s team. Each Pokemon has a 99 second time limit in battle, Pokemon can be switched out during the battle, Gym battles can be ended early by leaving them, and items cannot be used once the challenge begins.
Although six Pokemon can defend a Pokemon Gym, only four will be battled back to back. The 99 second timer will reset between Pokemon, but HP and charged attack progress will remain the same. After all four Pokemon are defeated, all six Pokemon defending the Gym will have their CP reduced by 1/3rd.
Tap the opposing Pokemon to use Fast Attacks and begin charging up the Charged Attack(s). Tap the Charged Attack icon when ready to perform the stronger ability. Fast attacks can’t be used for a few seconds while the Charged Attack is being performed.
Once a Pokemon has been defeated in battle, their overall CP will drop a small amount. A Pokemon usually faints and leaves the Gym after three battles. Remember, Pokemon have certain types that are stronger or weaker to other types in both attack and defense. Refer to the Type Chart below. Credit to Reddit user Alpha Nation.
Once all six Pokemon have fainted at a Gym, the Gym can be claimed for the winning Team. If no team claims it, another team can leave their Pokemon and claim it. The color of the Gym will change, teammates can leave Pokemon to defend the Gym, and Trainers from the same team will get a bonus when spinning the PokeStop.
A defending Pokemon can be viewed from your Pokemon Storage menu. This is also a quick way to return to the Gym without having to physically be there. After a defending Pokemon faints, they will return to their Trainer with 0 HP and some Gold Coins. One Gold Coin will be earned every 10 minutes to a max of 50 Gold Coins per day. Gold Coins are used to buy items at the in-game shop.