Set Out to the Sea! Line of Chonchie!! - S5-E3
Continuity mistake: In "Around the Whirlpool", when Ash uses his Pokédex, the top button like a line is five millimetres wide and ten millimetres long, but when Ash uses it in this episode, the button is one millimetre wide and five millimetres long. Also, the end of his left thumb and index finger are entirely covered by the Pokédex, but in the next shot, they are not. (00:01:47)
Answer: He is a good guy but just found himself in a bad situation when he worked for Lysander. He didn't want him to harm Ash and his Pokémon when he was trying to get the special bond between Ash and his Greninja to work. He does leave Lysander and go back to being a good person.