Comets are small, icy objects that orbit the sun. Because they are icy, their surface vaporizes a bit when they traverse the inner solar system. This vaporized gas streams away from the sun in a nebulous tail, hence their ancient designation as “hairy stars.”
Comets are generally categorized as “periodic” (with a period less than 200 years) and “non-periodic” (periods greater than 200 years). Periodic comets such as Halley’s comet make an appearance in the inner solar system every generation or so, whereas non-period comets such as Hale-Bopp generally sweep through the inner solar system and leave, never to be seen again (at least not in a millennia or two).
Because of their gradual evaporation, periodic comets don’t last long on a geologic scale. Over time they will disappear. So it’s generally thought that periodic comets were once non-periodic ones that were perturbed by Jupiter or other planets into a short periodic orbit. Of course that raises the question: from where do the non-periodic comets come?
A clue can be found in looking at their orbits. There are about 250 known periodic comets, and over 2000 known non-periodic ones. I’ve plotted the inclinations and ascending nodes of each orbit in the figure here. The inclination is the tilt of their orbit relative to plane of Earth’s orbit, and the ascending node tells you the orientation of the orbit around that plane. The periodic comets are in red, and the non-periodic ones in gray.
As you can see, most of the periodic comets lie within about 30 degrees of the Earth’s orbital plane. This makes sense for objects that are “captured” by the planets. The non-periodic comets, however, are all over the place. Except for a bit of clustering, their orbits appear pretty random. In other words, non-periodic comets can come from pretty much any direction.
Since the non-periodic comets can come from anywhere, their source likely forms a spherical halo around the Sun, known as the Oort cloud. We haven’t directly observed the Oort cloud yet, but models put it at around 2,000 AU to 50,000 AU. That outer range is about 1/5 the distance to the next nearest star, so it is also likely that the Oort cloud contains material from other star systems as well as ours, which means some comets could be visiters from another star.