I havent seen this in a while myself but it should be at episode 29 called "The Punchy Pokemon". in the episode they kinda have this fighting tournament or something in which Ash wins of course. And in the end Ash leaves his Primeape with some guy (who he met at the tournament) to train.