Mass is a measure of the amount of matter that an object contains, while density is a measure of how much mass an object contains per a unit volume. Mass is measured in kilograms, while density is typically measured in kilograms per cubed meter. Both are widely used in scientific formulas that are crucial for engineers, scientists and other professionals.
Density is the more practical unit to use when trying to compare two objects or materials. Comparing mass of two objects is typically pointless as they will be different sizes. For example, a small rock may weight less than a full-sized basketball, but if a person had a similarly sized basketball (with the same volume as the rock), the rock would weigh much more; regardless of the size of the rock and basketball, the rock will have a much higher density, even if masses differ.