Newton's cannonball seemingly applies here, which I suspect is the basis for your question.
An unpowered orbiting body will revisit its position, so anything that got shot off from the surface of the Earth must revisit the Earth. That is correct.
However, unpowered is the issue here. If something interferes with this object mid-orbit, it can alter its trajectory.
As a simple thought example: if I throw a ball up, it will come down again. It will not "bounce" in the air. Launch, upwards, downwards, landing. That is the sequence of events.
But if I throw a second ball and manage to hit the first ball with it, I can alter its trajectory, potentially changing it from moving downward to moving upward again.
Given the right force and the right timing (and non-atmospheric altitude), the first ball could change trajectory into a sustainable orbit.
It's important to realize that all these bits of debris were bumping into each other, constantly altering the trajectory. The bits that came up hit the bits that came down. While the odds of hitting the other bit with the exact force for one (or both) to achieve orbits is rather low, there was a lot of debris.
Given the law of big numbers, it's statistically likely for a subset of the debris to achieve a stable enough orbit. Everything else fell back down or escaped Earth's gravity well.
Note also that the dust didn't need to achieve an orbit that's close to circular. What is more correct is to say that the Moon's current orbit is basically an averaging out of all of the dust particle's trajectories, which very basically averaged out as they impacted each other and became a single object.
These original dust trajectories could have all been wildly different, and it is a fair presumption that they indeed were, before forming the Moon.