The hacked Pokemon themselves cannot do a thing to your game files.
It's the methods through which you obtained them from that do. If you personally coded those Pokemon into your game file, there's a good chance that it could corrupt your game file; delete information or just straight up crash it. But if you didn't, then no need to worry, your game's safe.
However, there are some rules on online plays that disallow the use of hacked Pokemon, like for instance wrong stats, moves, abilities, levels etc. So while you may have hacked Pokemon with you, you cannot really do anything with them other than collect them like action figures.
Hope I helped!