What are comets?
Like asteroids, comets are suspected to be remnants of planet formation in the Solar System about 4.6 billion years ago. But while asteroids are generally comprised of rock and metal, comets are more akin to dirty snowballs. They are composed of frozen gases such as carbon dioxide, methane, and ammonia, as well as water ice, in which dust particles and rocky material are embedded. As a comet approaches the Sun, solar radiation "melts" the surface, vaporizing molecules of gas and dust and creating the brilliant tail comets are best known for. A comet's tail will always point away from the Sun, which means it doesn't always trail behind the comet on its journey, but rather can travel beside or in front of it.
Where do they come from?
Comets spend most of their lives far away from the Sun in the distant reaches of the solar system. They primarily originate from two regions: the Kuiper Belt, and the Oort Cloud. The Kuiper Belt is a disk composed mainly of icy bodies that stretches from about Neptune's orbit (around 30 AU from the Sun on average) out to about 50 AU from the Sun. The Oort Cloud is at the edges of the Sun's gravitational influence (about 50,000 to 200,000 AU) and divided into two regions: the inner, disc-like Hills cloud, and the outer spherical cloud, both composed of icy bodies. Short-period comets, which orbit the Sun in 200 years or less, are usually Kuiper Belt objects, while long-period comets that take hundreds or thousands of years to orbit the Sun generally come from the Oort Cloud.