Like other planets in the solar system, Jupiter is thought to have formed by a method known as core accretion. The large planet formed after the sun came to light, and likely had an impact on the formation of other planets in the solar system.
The core accretion model
Approximately 4.6 billion years ago, the solar system was a cloud of dust and gas known as a solar nebula. Gravity collapsed the material in on itself as it began to spin, forming the sun in the center of the nebula.
With the rise of the sun, the remaining material began to clump together. Small particles drew together, bound by the force of gravity, into larger particles. The solar wind swept away lighter elements, such as hydrogen and helium, from the closer regions, leaving only heavy, rocky materials to create terrestrial worlds. But at greater distances from the sun, the solar winds had less impact on lighter elements, allowing them to coalesce into gas giants such as Jupiter. In this way, asteroids, comets, planets, and moons were created.
Jupiter is composed almost completely of hydrogen, with about 10 percent of its volume made up of helium. Small traces of other elements exist in Jupiter's atmosphere, as well, but most of its mass is held by these two basic elements.
Like all planets, the frequent collisions elevated temperatures on Jupiter. Dense materials sank to the center, forming the core. Some scientists theorize that the core today might be a hot molten ball of liquid, while other research indicates that it could be a solid rock 14 to 18 times the mass of the Earth.
In order to capture the necessary hydrogen and helium to fill up its atmosphere, Jupiter had to form quickly before they were swept away by the solar wind. Once the rocky material at its core reached about ten times the size of Earth, the planetesimal had sufficient mass to capture lighter gases such as hydrogen and helium.
The disk instability model
But the need for a rapid formation for gas planets is one of the problems of core accretion. According to models, the process takes several million years, longer than the light gases were available in the early solar system. At the same time, the core accretion model faces a migration issue, as the baby planets are likely to spiral into the sun in a short amount of time.
According to a relatively new theory, disk instability, clumps of dust and gas are bound together early in the life of the solar system. Over time, these clumps slowly compact into a giant planet. These planets can form faster than their core accretion rivals, sometimes in as little as a thousand years, allowing them to trap the rapidly-vanishing lighter gases. They also quickly reach an orbit-stabilizing mass that keeps them from death-marching into the sun.
A good neighbor
Because the massive planet formed so early in the history of the solar system, it most likely impacted the creation and paths of other planets. The planet itself would have had sufficient mass to alter the path of other baby planets that traveled near it, sending them veering either into the outermost reaches of the solar system or toward a fiery death near the sun. Comets and asteroids could have been similarly cast out.
The asteroid belt between Mars and Jupiter contains a significant number of rocks, including the minor planet Ceres. Scientists think that gravitational tugs from Jupiter kept the slew of material from creating another planet in the solar system.
— Nola Taylor Redd, SPACE.com Contributor