Figure: On the left is the Jupiter Family comet Shoemaker-Levy 9. It broke apart from gravitational interactions with Jupiter and eventually crashed into Jupiter in 1994. The bright ovals in the lower part of the picture on the right are where pieces of Shoemaker-Levy 9 hit Jupiter. A bright spot in the upper left of the picture is the Galilean moon Io.
Comets are usually categorized into two groups: the long period comets and short period comets.
The short period comets have orbital periods less than 20 years and low inclination. Their orbits are controlled by Jupiter and thus they are also called Jupiter Family comets. The short period comets are believed to originate from the Kuiper Belt. The Kuiper Belt is a large reservoir of small icy bodies just beyond Neptune, of which Pluto is a member. These Kuiper Belt objects also have very low inclinations. From collisions or gravitational perturbations some Kuiper Belt objects escape the Kuiper Belt and fall towards the Sun. When they approach the Sun their volatile elements will start to sublimate off the surface and we will see the object as a comet. Because the orbit crosses that of Jupiter, the comet will have gravitational interactions with this massive planet. The object's orbit will gradually change from these interactions and eventually the object will either be thrown out of the Solar System or collide with a planet or the Sun.
The second class of comets, the long periods, are believed to originate from the Oort cloud. This is a vast spherical reservoir believed to exist at the edge of the Solar System. The long period comets have periods greater than 200 years and no preference in orbital inclination.