What to do if your pokemon won't obey you?

It's due to to high a level and not enough badges. The more badges you have, the higher level pokemon will obey. A level 100 will not obey until all of the gyms have been beaten.