Professor Kodama had a lab just behind a Pokemon Center where he was working on a machine that would make Pokemon like each other. He was getting mad with his machine because it wasn't working on his Magnemite and Quagsire.
The machine was in fact working and it wasn't till Ash and his friends showed up with Pikachu and Piplup that he realized that his machine worked. Team Rocket who had been with him at the lab, quickly decides to steal the machine. His machine ended up getting destroyed and returned all the Pokemon in the area back to normal.