An Egg move is any move passed down from a Pokémon breeding pair to their offspring, which it would not normally possess at the level it hatches. The term is also frequently used specifically for moves that a Pokémon can acquire only from breeding (i.e. moves that the offspring cannot learn via level-up, TM or HM, or Move Tutor), though a Pokémon can inherit moves from its parents in other ways.
Before breeding a Pokémon, one must consider whether to use any Egg moves in that Pokémon's moveset, and breed accordingly. Sometimes, to get a certain combination of moves onto a Pokémon (such as a Spinda with both Wish and Baton Pass) several steps must be taken; this is called chain breeding.
Prior to Generation VI, all methods of learning Egg moves required the father to know the move prior to breeding, which made certain combinations of moves impossible to possess; for example, Tentacruel can learn both Rapid Spin and Mirror Coat as Egg moves, but no Pokémon in the Water 3 Egg Group can possess both moves at the same time prior to Generation VI (since Tentacool and Tentacruel now can). (Such a combination is possible in Generation VI, if one parent knows Rapid Spin and the other knows Mirror Coat.)
Explanation in more detail here.
If you mean how it actually happens, then there's no true answer to that.