For the sake of it. Terms as usually understood by most talking in these circles
Legitimate. Caught/bred in the normal gameplay loops and trained within them as well. In other games some might use further distinctions for hardware assist (
https://hackaday.com/2013/11/05/finding-shiny-pokemon-automatically/ ), save restoration (clones become possible) and emulator (turbo and savestate), or indeed glitch (first gen clones with link cable or missingno).
Legal. Used cheats to catch and/or level, possibly even directly. However could be a legitimate pokemon, even if improbable* individually or as a whole team**.
Illegal. Used cheats to catch outside of expected locations, give stats not achievable within the game, give moves that it could not normally learn (
https://pokemon.neoseeker.com/wiki/Wondertomb )...
*there could be a further method where Nintendo grabs saves and backups thereof, or snatches them from whatever cloud service they are using to determine whether something magically appeared full level and whatnot. Not seen this in the wild though.
**choice video on luck in games and the sorts of calculations that would be in play, albeit tweaked accordingly for the catch rates/times.
There have occasionally been event pokemon and other failures in the systems Nintendo uses to determine legal and not (both false positive and false negative), and likewise the save editors, like pkhex mentioned above, that claim to determine the same are also not without flaw on occasion (though as late in the day as this is that is less likely to be a thing).
I don't know the calculations here offhand for this generation but looking at some of the others then some of the shiny stuff might not line up with perfect IV. If this is one that merely needs a match between random number and trainer number then so it goes.
You might also encounter the term tournament legal. For the overwhelming majority of cases they will proclaim a need to be legitimate (though how they can tell, that being they can't, is a different matter) but what that refers to is in tournaments they (usually wrongly***) proclaim some pokemon to be overpowered and disallowed in that.
***see amounts let back in after someone develops an effective counter play, though as I suppose tournaments are not there to discover the best but instead be a spectacle**** then having all people using the same "overpowered" team gets kind of boring.
****give or take the paradox of chastising players for playing a weaker game in lower rounds/lesser tournaments to prevent others from learning their moves inside and out.
Also if I am linking videos for fun then
That would have some implications here if the generated data gets questioned.
Also
While they played it up a bit for the camera (not as bad as hacking sequences in films but it set off the same alarm) some of the associated metadata in that case they used to regenerate things based on valid patterns would be another vector Nintendo (or some uppity tournament checker) could use, or use functional equivalent thereof.
Anyway that is an awful lot about pokemon from someone that does not like it, failures in tournament design and hacking-counter hacking though... that gets me up in the morning.