Question: how gyms work pokemon go?
Answer: Battle at Gyms. A Gym controlled by a rival team can be claimed by defeating the Pokémon on the Gym. Each time you defeat a rival Pokémon, you reduce its motivation. When a Pokémon's motivation is reduced to zero, it will leave the Gym and return to its Trainer the next time it loses a battle.