Density is a measure of how much matter (mass) is found within a given space.
When a fluid with a high density (more mass in a given space) encounters a fluid with a low density, the fluid with low density will be buoyant, while the high-density fluid sinks.