M4A is AAC in Apple's favorite outfit: the audio-only MP4 your iPhone speaks natively. It was born in 2003, popularized by Apple's iTunes Store, and its real weak spot is older Windows software and stubborn car stereos that expect a .mp3.
OGG is the free spirit of audio: open, patent-free, and quietly brilliant at looping game sound. A container usually carrying Vorbis or Opus audio, both open and royalty-free. That makes it the right destination when what you need is games and open projects that want seamless loops and zero licensing strings.