This article has a good explanation.
A team of researchers affiliated with several institutions in Japan, examining data from that country’s moon-orbiting Kaguya spacecraft, has found evidence of oxygen from Earth’s atmosphere making its way to the surface of the moon for a few days every month. In their paper published in the journal Nature Astronomy, the researchers describe what data from the spacecraft revealed.
Scientists have known for some time that the moon is constantly bombarded with particles from the solar wind and have also known that once a month, as the Earth is positioned between the sun and moon, the moon is protected from the solar wind. In this new effort, the researchers describe evidence of oxygen ion transport from Earth’s outer atmosphere to the lunar surface during this short periodic time period.
Prior research has shown that oxygen atoms become ionized in Earth’s upper atmosphere when they are struck by ultraviolet light. Sometimes, this causes them to speed up to the point that they break away from the atmosphere and move into what is known as the magnetosphere, a cocoon that surrounds our planet that is stretched like a flag away from the direction of the sun due to the solar wind—so far, in fact, that it covers the moon for five days each lunar cycle, causing the moon to be bombarded with a variety of ions. Data from Kaguya now suggests that some of those ions are oxygen. The researchers found that approximately 26,000 oxygen ions per second hit every square centimeter of the moon’s surface during the deluge.
Because the moon is protected from the solar wind by the Earth when the increase in oxygen ions was recorded, the researchers are confident they come from the Earth. Adding even more credence is that the ions were found to be moving slower than those that normally arrive via the solar wind. Also, they note, prior research has found lunar soil samples containing some degree of oxygen-17 and oxygen-18 isotopes, which are not typically found in space, but are found in the ozone layer covering Earth.