Density is a derived unit because it is calculated from mass and length, which are both base units. Density for an object or substance is defined as mass divided by volume, where volume is defined as length cubed.
Derived units, sometimes called compound units, are different from base units because they are calculated from the base units mass and length. Density is one derived unit; force, area, volume, specific volume and mass fraction are also derived units. Each derived unit is defined by a quantity equation. Because density is mass divided by volume, its quantity equation is M/L^3, where M is mass, L is length and L^3 is the quantity equation for volume.
It is common when measuring density to measure mass and volume in the same system of units and at approximately the same scale. For instance, density is never measured in tons per cubic centimeter because tons are from the English system of units and centimeters are from the metric system. Tons and centimeters are also at different scales: a ton is a relatively large unit while a centimeter is relatively small. Two commonly used units for density are kilograms per cubic meter (metric) and pounds per cubic foot (English).