In terms of how to get the gcode permanently embedded -
What is the CNC machine connected to? Do you already have a breakout board and motion controller? This then needs to be connected to a PC or mini PC then the gcode can be stored on a USB stick and left in the PC to run the code. Same for the mini PCs. There are also standalone controllers which take USB drives containing the code and these don’t need a PC. I only ask the above as you only mention the machine and gcode. There are other bits needed to get it all going so your options depend on what you have now.

You also mention Arduino so I’m wondering if you plan to hook up this to the machine and embed the code there ? Or maybe GRBL ?

Also Nema 17 and Ender 3 comments make me wonder if this is a small machine like a 3D printer, rather than a heavy duty CNC machine?

You will get more specific advice if you can give a few more details on the project and ideally a photo of what you have.