A planet is an astronomical body orbiting a star or stellar remnant that is massive enough to be rounded by its own gravity, is not massive enough to cause thermonuclear fusion, and has cleared its neighbouring region of planetesimals.
The Moon does not orbit the Sun directly, so it is not a planet.
In the past, it sounds like it was its own body and happened to stray into Earth's gravity well...and the rest, as they say, is history
Except that theory seems to have been disproven and that it formed after another sphere collided with primordial earth billions of years ago, the resulting mess coalesced into the moon. when the astronauts brought back moon samples the geological makeup was very similar to Earth's