When did you join? Very early on the was a bug that allowed Pokemon to be caught that shouldn’t be, including legendary Pokemon. Perhaps it could have been around then? Or could it have been a shadow of something similar?
Sorry, didn’t read your message properly! Did you see it on your tracker or did it appear in your Pokedex? I have a Farfetch’d in my Pokedex, which I think came from clicking on a gym that had one.