Why is the density of particles in Earth's atmosphere above surface-level so much less than ground and below? Why, instead, isn't Earth simply a ball of swirling gasses / liquids, which become progressively denser as you approach the core (since gravitational pull is stronger closer to the core)?
Roughly put, it's the same thing that makes a density step function when you try to combine oil and water:
The components do not mix with or dissolve into each other, so gravity makes the denser material -- water -- settle to the bottom. The density as a function of height jumps up from the oil density to the water density when you go below the interface.
In the case of Earth, there are several progressively denser phases that do not mix. The biggest step in the density gradient is when the rock phases (olivine, spinel, perovskites, and ferropericlase which is not shown in the illustration below) give way to the much denser core. In the illustration below, this boundary is where the bottom part of the rocky mantle, the D" layer, meets the predominantly iron core.
One major difference between the interior of Earth and the oil-water combination in the first picture is that much of Earth's interior is solid, so it takes a lot of heat and pressure -- both generated by gravity -- to make the materials yield and flow to their equilibrium positions. The same is true of other predominantly solid celestial bodies, so only relatively large and massive ones have enough gravitational power to enable separation of different density phases. Planetary scientists call this process differentiation.
Planets in our solar system have strikingly different chemical compositions - the four rocks closest to the sun (Mercury, Venus, Earth, Mars) have most of their mass made up of rocky and metallic elements (the centre of the Earth is mainly nickel and iron), whereas the gas giants of Jupiter and Saturn are made up of much lighter and simpler elements (mainly Hydrogen and Helium)
Jupiter has hydrogen all the way to its core, where pressures are so intense that a form of 'metallic hydrogen' is thought to exist there. So yes, there are less step-changes in elemental composition and therefore less step-changes in density - however, density step-changes still do exist where matter (even the same elements) exists in different states under different conditions - e.g. gas, liquid and possibly metallic hydrogen at different pressures and temperatures. That is a feature of chemistry.
The reason for the elemental difference in the planets is partly due to the make-up and distribution within the accretion disk, the swirl of elements that existed when our solar system formed. Also, planets that are as big as Jupiter have such a strong gravitational pull that they are able to hold onto (and pull in more) of the lighter elements like hydrogen and helium, which are the most abundant in the universe. Jupiter is actually like a half-there star, sometimes referred to as a 'failed star'.
However, the Earth is still large enough and has a protective magnetic shield generated by its iron core that allows its atmosphere not to be blasted away by the solar wind. This means we have both a stable gaseous atmosphere as well as a metallic and rocky interior, meaning a step-change in densities between solids and gases.
It is also worth noting though that our gaseous atmosphere is only 60 miles thick, whereas the Earth's radius is about 4,000 miles. The planet is much more of a homogenous solid than you might think, being as we are atmosphere dwellers.
Atoms also interact electromagnetically, and this changes their behaviour. In particular, iron will form metallic bonds, while silcon will bond covalently with oxygen forming massive solid structures. On the other hand, Nitrogen will bond to itself forming small molecules that don't link to other molecules. As a result, the iron and silicates will form a solid with much higher density than Nitrogen. The iron and silicates will then fall together with the nitrogen floating above, and there will be a sharp step change in density as you move from the region where there is Nitrogen (and other gases) to the region where there are silicates (and other minerals)
If Electromagnetic forces didn't do this there would be only a galaxy-sized blob of Hydrogen and Helium nuclei, as we see with the dark matter halo (which interacts gravitationally but not electromagnetically)
It is the electromagnetic interactions that form chemical bonds, and the different types of interaction between different chemical species, that explain why there is a sharp change in density at the boundary between crust and atmosphere, or between ocean and atmosphere.
Similar step changes also exist between ocean and crust, and within the Earth, between the mantle and the core.
World is about 4.5 billion years old. At the beginning its density function is linear. Since the beginning world mass loosing its heat. The heat of the earth is high enough to cause convection currents. Convection currents works like an elevator from center to the surface. This convection currents makes the mass inside earth to move upwards, then downwards nonstoppingly, since its formation. This movement center to edge has average 1 mm/year velocity. For 4.5 billion years, thousands of times this tour completed. The action takes place by partial melting. Large ion/charge elements are unwanted in crystal structure and they leave the crystal first during melting. They are transferred to crust via this melt. Due to this repeatingly mass translation earth has been developing its layered structure with characterised by step function. The process is called differentiation and time is an element of this function.
The differentiation phenomemon is also responsible for plate tectonics; formation of continents, earthquakes, life.