Comets have tails because as they grow closer to the sun the material they're made of sublimates. The solar wind and radiation then pushes some of the dust and gas of the comet into tails that can be millions of miles long. Comet tails always face away from the sun.
Scientists believe that comets are made out of dust and ice made out of methane, carbon dioxide, ammonia and other materials that might enclose a core made out of rock. In contrast to the tails, these cores might be less than 10 miles across.
When the ices of the comet first begin to turn to gas, they form a sort of halo around the comet that's called a coma. This coma can also be about a million miles around. Moreover, as comets streak through space they leave debris trails that might fall to the Earth as meteor showers. Some of these meteor showers are annual events. They have names such as the Perseids and the Orionids, named for the constellations they appear to originate from.
Some scientists believe that comets are the debris that was left over from the formation of the solar system. They originate in the Oort cloud, which is found in the outer solar system.