Comets are observed to come to the solar system from all directions, therefore the place from which the comets come is thought to be a giant sphere surrounding the solar system. This sphere is called the Oort cloud after Jan Oort who postulated its existence in 1950. Thus comets are said to come from the Oort cloud.
Mathematical theory suggests that the Oort cloud is very far away, as far away as 100,000 AU. In this picture, the solar system is buried deep within the cloud.
An AU is the distance from the earth to the sun and is roughly equivalent to 100,000,000 miles. Mars is 1.5 AU from the sun, Jupiter is 5 AU from the sun, and Pluto is 39 AU from the sun. So comets come from very far away indeed.
It is natural to ask "How did comets get so far away?" Astronomers are presently working to understand the answer to that question, but they think that early in the history of the solar system, planetismals which were formed between Uranus and Pluto were perturbed by the gravitational attraction of Jupiter and ejected from the central solar system to the Oort cloud. NASA is currently supporting research to understand more about comets, where they came from, and what they can tell us about the formation of the solar system.
This is page 15 of 60