Primordial matter left over from the creation of the Solar System is gathered in a cloud beyond Pluto. Small quantities of this cloud - known as the Oort Cloud - are perturbed into the inner Solar System and we see them as comets.
Most comets pass the Sun once before being flung out of the Solar System for good. It is logical to suppose that some comets that we see have originated around other stars before being flung out of their system and into the Solar System. However, no such interstellar comets have been positively identified and the chances of a comet randomly targeting our system are small.
A few comets are in orbits that interact with the planets - notably Jupiter - and become captured. These return to our skies periodically. The most famous is Halley's comet which is featured in the Bayeux Tapestry depicting the events of the Battle of Hastings in 1066. The comet has returned to our skies every 76 years. Such periodic comets are assigned a number by the Minor Planet Center.
Although not all comets have tails, some have one or two tails composed of either dust or gas which grow from the nucleus when the comet is close to the Sun.
The longest tail recorded to date is on Comet Hyakutake

The Alphastro Home Page is http://www.alphastro.com and is operated by Lindoponline
Alphastro.com was registered through Names.co and
I recommend their service to all webmasters. Click the banner for more details.
Should you have any comments about this site, please email the webmaster