This is because traded Pokémon are considered "unfriendly" until they reach level 30. So, even if you trade a level 50 Pokémon, it won't listen to you until it reaches level 30. You'll need to level them up through battling in the wild or using other methods.
However, if you're talking about the Pokémon you catch in your own game, then defeating the first gym will allow them to listen to you regardless of their level. This is because they're already considered friendly as they're part of your team from the start.