In the main Pokémon series, Pokémon gyms are places that trainers go to to train with their Pokémon. Gyms are also places that the player conquers to get badges, which are needed to challenge the Pokémon League of their region. In Pokémon GO, gyms are a different place, Pokémon GO gyms are currently the only places where you can use your Pokémon to battle with others.
Gyms are pretty distinct structures in the overworld map. They are white structures with team colors representing the team currently controlling the gym: red for Team Valor, blue for Team Mystic, Yellow for Team Instinct. You can also see what Pokémon are defending that particular gym by tapping on it.
Gyms have a lot of mechanics tied-in with the various teams in Pokémon GO. If your team is currently controlling the gym, you can leave one of your Pokémon to help defend it or train with the Pokémon to raise the gym’s prestige level. Or if it belongs to an enemy team, you can try and conquer it for your team.