Let us assume on contrary that $\text{Ker}(T)=0$.
Now we will use a standard result which says $\text{Ker}(T)=\overline{\text{Ran}(T^*)}$
As $T$ is self-adjoint, $T=T^*$. So $\text{Ker}(T)=\overline{\text{Ran}(T)}$.
Therefore, $\overline{\text{Ran}(T)}=H$.
From here, I can't proceed. If I can show $\text{Ran}(T)$ is closed we are done. Although I haven't use the compactness of $T$ yet.
Can anyone help me complete the proof? Thanks for help in advance.
The claim is not true for separable $H$. Define $T:l^2\to l^2$ by $$ Tx = (x_1, x_2/2, x_3/3,\dots), $$ which is compact, self-adjoint, and injective. It is not invertible as $(1,1/2,1/3,\dots)\in l^2$ is not in the range of $T$.
If $H$ is non-separable then the claim follows from the spectral theorem.