An NC program typically combines G-codes and M-codes together to form a set of instructions that a CNC machine will carry out.
G-codes (or geometric codes) typically control how and where a machine should move (for example moving a linear/rotary axis from one position to another).
M-codes (or machine codes) are used to control different modes or functions within the machine (for example turning coolant on, loading a cutter into the spindle, activating the spindle and turning it clockwise, or controlling whether the machine should position itself using absolute or incremental mode).