Not sure this is a g-code issue, but most people using Fusion 360 use the post processor you can find in this topic. It supports both Marlin and GRBL.
One “fly away” issue I’ve seen on this forum was traced to electrical noise corrupting the g-code.