Beides a corrupt SD card that stores worng bits, leading to absurd commands, it's also possible that ithers parts in the Creatin of the file are compromised:
This can for example happen if the card is removed during writing - but in this case it should be mostly an incomplete file on importing into an interpreter.
More a random distribution of bad commands would appear if the writing process in itself is faulty, for example if the SD Port is defect or the adapter hast a error. Another way that writing can fail is if the drivers for the SD card adapter/port are corrupted.
To detect a bad file or corrupted card is possible by re-importing the G-Code into a slicer (for example CURA allows this) and look at the tool paths. If any port does this with any card, software is to blame: See if it persists after a driver update (rare!) and a reinstall of the slicer. If it fails in one port but works in a different the port or adapter might bei at fault and might need replacement. If it is endemic to one card, this one is corrupt and to be thrown out. If it is endemic to a single file, overwrite it with a new one - sometimes writing fails for reasons that are almost impossible to understand.
If the file&card are fine but read wrongly at the printer, then the card reader in the printer or the board are to blame.