My cat taught himself to pee in the toilet

I adopted Wally when he was three, and around his fifth birthday he decided to start using the human toilet??? My partner and I have caught him doing this 4-5 times now, and he only pees in the litter box otherwise (as far as we know). So, we’re left wondering—did his previous owners teach him this, or is Wally a pee genius? Has anyone else experienced this?