Another theory is that they come from a gaseous cloud called the Oort cloud which is cooling out there after the organization of the sun. As this space debris cools, it gets organized into one body which then gathers sufficient mass to be attracted into the gravity of our solar system turning into a fast moving comet plummeting toward our sun. However, because of the strong gravitational orbits of the many planets in our solar system, the comet does not always immediately collide with the sun and often takes on an orbit of its own.
The life expectancy of comets varies widely. Scientists refer to a comet that is expected to burn out or impact the sun within two hundred years as a short period comet whereas a long period comet has a life expectancy of over two hundred years. That may seem long to us as earth dwellers but in terms of stars and planets, this is a very short life as a space object indeed.