Why did Misty leave the Pokemon anime?
Misty left at the end of the original Pokemon series because her sisters won the lottery and wanted to travel around the world, so they asked Misty to stay at the gym to be the gym leader. This is in episode 273 of the anime. Of course, Misty didn't want to and wanted to travel more with Ash, but eventually she left to become the gym leader after a battle with a nasty kid along with Ash, who was showing signs of unwillingness (which made her feel a tad bit better).

As for Brock, he needed to go home and visit his family, and he pretended he forgot about this until the very last minute. So Brock, Misty and Ash each went back to their home and that was the end of the little team. Then, when Ash got home, Gary left as well, so he got bored and decided to go to Hoen where he meets Max, May, and reunited with Brock.

P.S. it was at the end of the anime too so they needed to find a reason to finish the series.