There are two theories as to how planets in the solar system were created. The first and most widely accepted, core accretion, works well with the formation of the terrestrial planets like Mercury but has problems with giant planets.
The second, the disk instability method, may account for the creation of these giant planets. Scientists are continuing to study planets in and out of the solar system in an effort to better understand which of these methods is most accurate.
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 up. Small particles drew together, bound by the force of gravity, into larger particles. The solar wind swept away lighter elements from the closer regions, leaving only heavy, rocky materials to create smaller terrestrial worlds like Mercury. But farther away, the solar winds had less impact on lighter elements, allowing them to coalesce into gas giants. In this way, asteroids, comets, planets, and moons were created.
Like Earth, the metallic core of Mercury formed first, and then gathered lighter elements around it to form its crust and mantle. Mercury, like other planets, likely collected the more nebulous pieces that would form its atmosphere. Unlike its siblings, however, the planet's small mass (Mercury is the smallest of the planets) and close proximity to the sun kept it from keeping a firm hold on the gases. Interactions with the solar wind constantly strip the planet of its thin atmosphere, even as it provides an influx.
The disk instability model
Although the core accretion model works fine for terrestrial planets, gas giants would have needed to evolve rapidly to grab hold of the significant mass of lighter gases they contain. But simulations have not been able to account for this rapid formation. 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 change of pace
Studies of Mercury reveal that its core is significantly more massive than expected in relation to the rest of the planet. With a radius of between 1,100 to 1,200 miles (1,800 to 1,900 kilometers), the mostly-iron core stretches through 75 percent of the planet's diameter and makes up a significant amount of its volume. The crust, on the other hand, is only 300 to 400 miles (500 to 600 km) thick. From this, scientists concluded that Mercury's formation process could have varied slightly from the other planets.
If a larger Mercury formed quickly enough, it could have consolidated before the sun reached its peak. Elevated temperatures from the young star could have then cooked away much of the light crust, leaving only a small shell around the planet.
More likely, however, is that Mercury suffered a violent event early in its life. Scientists theorize that the original planet, more massive and thicker crusted, could easily have been struck by a large body in the violent early solar system. Such a collision would have blown much of its crust into space, leaving behind a massive core enclosed by only a thin shell.
— Nola Taylor Redd, SPACE.com Contributor