This is the so called operator approach of the Harmonic oscillator(HO). In the real space representation, the Hamiltonian has the familiar form $$\hat{H}=\frac{\hat{p}^2}{2m}+\frac{1}{2}m\omega^2\hat{x}^2$$. By solving the time-independent Schrodinger equation, we can obtain the eigenstates and eigenenergies $E_n=\hbar \omega(n+\frac{1}{2})$. That is the HO has different states with corresponding energy level.
In the algebraic approach, the Hamiltonian takes the form $$\hat{H}=\hbar \omega\left(\hat{a}^\dagger \hat{a}+\frac{1}{2}\right)$$. The physical interpretation is that now there is only one state for the HO and we can put bosons in this state. For example, the ground state corresponds to the vacuum state(no bosons). The first excited state corresponds to putting one boson in that state and the second excited state corresponds to putting two bosons on that state and so on. So we can use the occupation number representation |n> as the eigenstate. For example, |0> means the ground state with 0 boson. |4> means there are 4 bosons in the state and |n> means there are n bosons. As you can find in any textbook, the term $\hat{a}^\dagger \hat{a}$ is the so-called number operator that counts how many number of bosons in the state |n>. i.e. $$\hat{a}^\dagger \hat{a}|n>=\hat{N}|n>=n|n>$$ Thus, the Hamiltonian now becomes $$\hat{H}=\hbar \omega\left(\hat{N}+\frac{1}{2}\right)$$ and the energy is just the same as before $E_n=\hbar \omega(n+\frac{1}{2})$. Now you can interpret the Hamiltonian as the total energy of bosons with the energy of each boson being $\hbar \omega$ which is just the energy difference between each consecutive eigenstates in the real space representation. The reason we can interpret it in this way is because the energy difference between each two neighbouring eigenstates(in real space representation) is the same(i.e. $\hbar \omega$).
Lastly, you can see that in the above Hamiltonian we only need to replace $\hat{N}$ with its eigenvalue $n$ to obtain the eigenenegies. This is because $\hat{N}$ commutes with the Hamiltonian and they share common eigenstates so $n$ is a good quantum number to describe the system.