The density of an object is the mass of a unit volume of the object.
The unit of volume is the cube of the unit of length. Length can be expressed in many units like meter or units derived from it like centimeter, millimeter, kilometer, etc., or it can be expressed in terms of feet, yard, etc. Volume can also be expressed in units of volume like liter, gallon, etc.
Similarly, mass can be expressed in grams, kilograms, pounds, etc.
Using any of these units we can arrive at the unit of density in terms of mass/(length)^3 or mass/volume. Some examples of the unit of density is gram/liter, kilogram/m^3, pound/gallon, pound/(feet)^3, etc.