First let $a_n\rightarrow\infty$, and assume that $\liminf a_n=m<\infty$. Then the sequence $\{a_n\}_{n\geq 1}$ must have infinitely many elements in the interval $(m-\varepsilon,m+\varepsilon)$ for all $\varepsilon > 0$. (To see this, suppose the opposite, and let $N$ be the largest index, where $a_N\in(m-\varepsilon,m+\varepsilon)$. Then we would have $\inf_{n>N}(a_n)\geq m+\varepsilon$, thus contradicting the choice of $m$.)
Since $a_n$ diverges to $\infty$, we have that for all $M\in\mathbb{R}$, there exists $N\in\mathbb{N}$, such that $a_n\geq M$, when $n\geq N$. Take $M:=m+\varepsilon$. Then we have a finite number (maximally $N$) of elements of $a_n$ in $(m-\varepsilon,m+\varepsilon)$, which is a contradiction. Thus $\liminf a_n=\infty$, and it follows that $\limsup a_n = \infty$.
Now assume $\liminf a_n =\limsup a_n = \infty$. This implies, that for every $M\in\mathbb{R}$, there exists $N\in\mathbb{N}$, such that $\inf a_n \geq M$ for $n\geq N$. Since the infimum is a lower bound, we have $M\leq \inf a_n \leq a_n$, which implies that $a_n$ diverges to infinity.