Comets are solar system bodies that orbit the Sun, just as planets do, except a comet usually has a very elongated orbit. Part of its orbit is very, very far from the Sun and part is quite close to the Sun. They are sometimes nicknamed dirty “cosmic snowballs,” because they are small, irregularly shaped chunks of rock, various ices, and dust.
As the comet gets closer to the Sun, some of the ice starts to melt and boil off, along with particles of dust. These particles and gases make a cloud around the nucleus, called a coma. The coma is lit by the Sun. The sunlight also pushes this material into the brightly lit “tail” of the comet.