Actually Welcome to the Concept of the Astrophysics.
Let's categorize them eventually ==>
1.) Earth ==> 1.) travels around the Sun
2.) takes 365.25 days .
2.) Moon ===> 1.) travels around the Earth
2.) Takes 27.3 days.
Gravity depends on distance and the moon is closer to earth
The first reaction is a synthesis reaction (A+B -> AB)