Moon has no atmosphere because the value of acceleration due to gravity on surface of moon is small. The escape velocity for moon is, $v_e=\sqrt{2gR},$ where $g$ and $R$ are the acceleration due to gravity and radius of the moon respectively. Since the value of $g$ and $R$ of moon is small, escape velocity of moon is also small.
The root mean square velocity of gas molecules is, \[c_{\text{rms}}=\sqrt{\frac{3RT}{M_m}}\]
On the surface of moon, the temperature is very high, especially at the daytime. So, the rms velocity of gas will be high enough to exceed the escape velocity. That’s why, all the gas molecules have escaped and there is no atmosphere on moon.