Here is a characterization of compactness in $\ell_2$.
Actually, it seems that $E$ is compact if and only if $a_n\to 0$.
Assume that $a_n\to 0$ when $n\to \infty$. Then $\frac 1{a_n}\to \infty$; in particular there is $K$ such that for all $n$, $\frac 1{a_n}\gt K$, hence $E$ is bounded. Since
$$\sum_{n\geqslant N}|x_n|^2=\sum_{n\geqslant N}\frac{|x_n|^2}{a_n^2}a_n^2\leqslant \sup_{n\geqslant N}|a_n|,$$
the third condition is satisfied. One can see that $E$ is closed in the following way: if $x^{(n)}\to x$ and $x^{(n)}\in E$ for all $n$, then for each $M,n$,
$$\sum_{i=1}^M\frac{|x_i^{(n)}|^2}{a_i^2}\leqslant 1.$$
Taking the limit $n\to \infty$, we have the same inequality for $x$, and we conclude $x\in E$.
Assume that $(a_n,n\geqslant 1)$ doesn't converge to $0$ and $E$ is compact. There is $n_k\uparrow \infty$ and $\delta\gt 0$ such that $a_{n_k}\geqslant \delta$ for each $k$. Define $x^{(k)}:=a_{n_k}e_k$. Then $x^{(k)}\in E$, hence the sequence $(x^{(k)},k\geqslant 1)$ admits a convergent subsequence, say $(y_j:=x^{k_j},j\geqslant 1)$. Since $y_{j+1}-y_j\to 0$, we get a contradiction.