A planet is a large object that orbits around a star or a stellar remnant. This is mainly due to its own gravity and gravity of the star that allow the planet to have an orbit around the star. The orbit is usually elliptical in shape, mainly depending on the gravitational force of the planet and the star.
The gravitational force of the planet is strong enough that it leads the planet to be rounded, i.e. compound its matter in a spherical shape. A planet has also cleared its neighboring region of any other debris. The planetesimals, i.e. other debris, should either get absorbed into the planet, or if it big enough to have a gravitational force of its own, it might become a satellite of the planet, i.e. moon, or will just float away into space.
As per the International Astronomical Union (IAU), “A "planet" is a celestial body that: (a) is in orbit around the Sun, (b) has sufficient mass for its self-gravity to overcome rigid body forces so that it assumes a hydrostatic equilibrium (nearly round) shape, and (c) has cleared the neighbourhood around its orbit.”