The GTS or Global Trading System is a mechanic introduced in Pokemon Black and White, and is a system that was used to trade Pokemon anywhere in the world with other people! You just put your pokemon up for trade, ask for a Pokemon in return, and you were good to go. This feature has continued to be used in Pokemon XY, Omega Ruby and Alpha Sapphire, Sun and Moon, Ultra Sun and Ultra Moon, and Pokemon HOME. Pokemon HOME is a storage program for your Pokemon, but it has continued to keep features such as the GTS, where it is not integrated into the newest games.
The GTS is broken for every Pokemon Game from XY to USUM(Ultra Sun and Ultra Moon.) Yes it still "technically" works but there is a big issue with them. For XY, or ORAS the GTS is filled with hacked untradeable Pokemon. When asking for the gender there it becomes blank and you're unable to trade anything for it. There are hundreds of thousands of these on the GTS. The GTS is also broken in another way. Because of people using messed up characters in combination with being able to change the color of their name, it has been causing a ton of crashes. While people awhile ago in the Pokemon community tried to #CleanTheGTS, to remove a bunch of Pokemon in the GTS that had swear words in them, this would be impossible now as you cannot trade with these hacked Pokemon. In Pokemon SM, and USUM, the situation is even worse. If you try to even enter the GTS, most of the time you will be met with a crash. The reason is because users (mainly bots) have made it so when the game attempts to load a person's profile picture the game crashes. (The entire 3ds freezes and you have to hold down the power button until it turns off.) Also if you try to trade with one of these hacked/corrupted Pokemon, then you get temp banned from trading for a variable amount of time (no longer than a week.) Unfortunately you don't even get to keep the Pokemon as it crashes right before you can keep it.
Well I'll start out with what you can do make this impact you as little as possible. This first method works for XY and ORAS, and does not require a modded 3ds. (There is technically a way to fix this with a patch but it's not publicly available to anyone.) Go into the GTS. Search for the Pokemon you want. Then in the bottom left click on the option to allow "Only Pokemon you Have." This makes it so all the trash hacked Pokemon don't show up, and should hopefully filter all the people who are crashing games. For people on SM or USUM you have a better option. Through the work of wonderful people, it is possible to browse the GTS normally (There's still corrupted pokemon though so just don't trade for anything super unrealistic or else you'll get the soft ban.) So you will need to mod your 3ds by following the guide here. This shows you step by step how to mod it (You can do a variety of other things, including control multiple 3ds's with an actual controller but that's outside the scope of this right now.) So now that you have that download or compile from source the patch here! It's already compiled in the releases page so I recommend that. Now that you have that, drag the folders into your /luma/titles/ folder (create one of there is not one already.) Then you enable game patching in Luma3ds (when starting up the 3ds from a powered off state hold select and power on. Then Turn on game patching, and press start to save.) If you go onto the GTS, all of the profile pictures will be replaced with your current profile picture, making you unable to crash.
There is a piece of custom firmware you can get on modded 3ds's called Checkpoint. This backs up your save file onto your sd card, you can reload it at a later point. If you want to be extra safe before trading to make sure you don't get soft banned, (and it's taking too long just putting your Pokemon on the GTS) then you can actually make a backup before you GTS trade. If you GTS trade and get soft banned, just reload your checkpoint save file and you'll be good. (I don't know what happens if you put a Pokemon on the GTS then do the reload though. I don't recommend it either way.)
People have been trying to clean the GTS for years, but considering you literally CANNOT trade some of these Pokemon off the GTS, I would say trying to purge or clean it at this point is a fools errand. If someone finds a way to take these off then I'd be glad to see it but bots are always faster than humans. Nintendo and GameFreak clearly isn't going to do anything about this. Closest thing they've got to mentioning it has been this. And even then that's a stretch to them acknowledging it. If you want to fix the GTS go ahead, but we can only do so much heavy lifting. Hopefully this helped somebody.
(To be technical, Nintendo does own Pokemon, well mainly their trademarks but there's a lot of factors. I'm not a major expert on it but message my email if you have questions.)