When inviscid lava flows out of the volcano, it is possible that cavities are created inside the conduits, due to the different speeds of flow and temperatures. It is like a roof being formed above the flow of lava, which continues to flow inside. After cooling of the rocks, tubular cavities remain.
This phenomenon exists on Earth when volcanoes erupt, and scientists assume that those tubes and cavities could also be prevalent on the Moon, dating from a time when vulcanoes were still active there. The lesser gravity benefited the formation of the tubes and might have also contributed to the fact that there could be kilometer-sized cavities underneath the Moon’s surface.
On the Moon there are large surfaces of solidified lava, which we can observe from Earth as lunar maria. Scientists watch these areas and continue to find more and more evidence that in certain sections there is a high likelihood that lava tubes may exist. This is particularly interesting with regard to moon bases that could possibly be erected inside these caves some time in the future. This would provide protection from external influences.
Sooner or later, we will know whether we can get to the inside of the Moon. How useful this will eventually be for humans, remains to be seen.