What is density in density functional theory?
The density in density functional theory (DFT) refers to electron density, which is the object of all DFT calculations. DFT differs from various other wavefunction-based methods which focuses on determining the ground-state $\ce {3N}$-dimensional wavefunction*, such as the Hartree-Fock (HF) method. Electron density, often denoted as $\rho$ or n(r), refers to the 3-dimensional function of 3 spatial coordinates describing the distribution of electrons in a given system. It is of interest in DFT as it allows us to determine all observable properties of the system without knowing the exact ground-state wavefunction, hence providing great computational ease. The following is the usual expression of electron density (for spin-restricted calculations, for a system of an even number of $\ce {N}$ electrons, which would have $\ce {N/2}$ different electronic energy levels since electrons in the same orbital are considered to have the energy, thus also meaning that we are summing only $\ce {N/2}$ of the different individual densities, and then multiplying by 2) that you would find in resources on DFT:

*$\ce{N}$ refers to the number of electrons in the given system. The wavefunction is a function of $\ce {3N}$ dimensions since each electron has 3 spatial coordinates. If spin is considered as a fourth coordinate, then the wavefunction becomes $\ce {4N}$-dimensional. Obviously, such a wavefunction would not be easy to solve for exactly.
However, I find it difficult to understand how density is used to calculate the energy of the system.
This is where the functional in the name DFT comes in. The 1st theorem of Hohenberg and Kohn tells us that:
Ground-state energy of the system is a unique functional of its electron density.
What exactly is a functional? A functional is a function of a function. A commonly used functional would be the definite integral. In Kohn-Sham DFT (which treats the system as comprising of non-interacting particles moving in an effective potential), notably the most widely-used version of DFT (another version being orbital-free DFT), the functional can be seen as comprising of three main contributions: 1) kinetic energy of electrons, 2) coulombic interactions between electrons and nuclei, and 3) coulombic interactions between pairs of electrons. However, there are some effects that we would need to take into account. For example, when we consider coulombic interactions of each electron with the electron density (in solving the Kohn-Sham equations), we also include a non-physical self-interaction (i.e. the interaction of the electron with itself). Particles in the system can also undergo exchange interactions and their motions are also correlated (i.e. they are not independent). Hence, another term called the XC (exchange-correlation) functional is also included into the overall density functional expression to account for all these additional effects that have not already been accounted for.
The following is an expression of the Kohn-Sham density functional taken from Wikipedia:

The first term is the electron kinetic energies, the second represents the electron-nuclei interaction energy, the third represents the electron-electron interaction energy, while the last term is the mysterious XC functional.
The site has more posts on the topic which you may find useful:
Are there any full worked examples of DFT calculations?
Density Functional Definition