Is there a cooldown when training in a friendly gym?
Yes, you can keep attacking a gym as often as you wish, provided you have the Pokémon with health to do it. I think there is a limit to how much prestige you can have and the level of the gym, but you can train at a gym as much as you want without a cooldown, and you will get experience from it every time.
source: personal experience
No, there is no cooldown, but I think the bigger issue is that you are misunderstanding what it's saying. It's saying you select one of your Pokemon to battle against the gym. You do not get to choose who in the gym you battle. It's always in order from lowest CP to highest CP. So your question about having to battle a different trainer doesn't make sense; you always battle the same Pokemon in the same order unless the Pokemon in the gym have changed for some reason.