If you go to a gym that's controlled by your team you can train there. The more battles you win at a gym controlled by your team the more status points it gets. The more points, the higher the level of he gym, the higher the level of the gym the more Pok?mon can be placed there and the harder it is to defeat. A gym of an opposing team is where you can battle them against the other team. The more battles you win at an opposing teams gym the less status points it gets. The less status points an opposing gym gets the lower the level of the gym and the less Pok?mon will be there. Once an opposing teams gym reaches zero points it becomes a neutral gym and the first team to place a Pok?mon there controls it and the cycles starts all over again.