That trainer wasn't a Swimmer though, I was surfing just to skip that fight but somehow they caught me and started walking on water. Is that some sort of glitch?
Yes, this is a glitch.
When the player enters the sight range of Ace Trainer Summer in Undella Bay from the north while surfing, she will walk over water and challenge the player to a battle.
Source