This is a bug with the "cancel" button in-battle. I unfortunately don't have a log, but I will explain what happened. (As you will see, a log would,'t be very helpful here anyway.)
My ferrothorn was up against the opponent's gengar. I selected leech seed. However, a few moments later, I changed my mind. I clicked the cancel button, and pressed the button to switch into my Jirachi. However, a split-second after I pressed the button to switch, the match proceeded with me using leech seed.
That's fine. It seems like it was a lag issue, which was not my complaint.
After that turn, the buttons reappeared and I used protect. However, several seconds later the game proceeded with a switch into Jirachi.
What I take from this is that my message to use leech seed was sent to the server, but the return message (i.e. the move's execution) had not arrived due to lag during one of the transfers, and therefore I was allowed to cancel my move and select a switch to Jirachi. By the time this message reached the server, however, the turn with Leech Seed had already been executed, and the switch to Jirachi was therefore interpreted as a selection for the next turn. The rest is history.