Comets begin as a mixture of ice and dust and end up losing their ice and gases each time they orbit around the sun. They come from the Kuiper Belt and the Oort Cloud. After around 500 passes, they lose most of their ice and gas content and eventually turn into something close to an asteroid.
A comet is also called a planetesimal, and it comes from the outer realms of the solar system. There are millions of comets in all directions at the far edge of the solar system. These icy comets orbit the sun in distant places, namely the Oort Cloud and the Kuiper Belt. They spend billions of years in these places. When two comets crash or draw close to one another, they change directions. This sometimes leads them to a path toward the inner solar system.
Comets shine brighter as they approach the warmer inner solar system. They also start to melt and leave tails that consist of plasma and dust particles. They lose their ice and dust as they enter the warmer part of the solar system, eventually melting away completely.
Like planets, comets orbit around the sun, but they take longer and are more elongated. Those that take less than 200 years to orbit are called periodic comets, whereas those that revolve around the sun for more than a hundred thousand years are known as long period comets.