Okay, I'm level 5, I have Pokemon that aren't currently defending a gym that are stronger than one of the Pokemon in a gym, but not another, do I have to defeat both for my Pokemon to be eligible to defend the gym? The gym is owned by my team.
If a gym belongs to your own team it can hold one defending Pokemon for each gym level. So a level 1 gym can hold 1 defender, level 2 can hold 2 defenders, etc. The spots are basically on a first come first serve basis. To level up the gym you can do "training" battles with the Pokemon that are in the gym by clicking the boxing glove icon on the bottom right.