Let $w$ be a nonzero algebraic number such that $\operatorname{Im} w = \pm\operatorname{Re} w$.
Clearly $w\not\in\mathbb{Q}$.
Suppose $[\mathbb{Q}(w):\mathbb{Q}]$ is odd.
Since $[\mathbb{Q}(w):\mathbb{Q}]$ is odd, it follows that
$i\not\in\mathbb{Q}(w)$, so
$[\mathbb{Q}(w,i):\mathbb{Q}(w)]=2$.
Then from the chain
$$
\mathbb{Q}
\subset
\mathbb{Q}(w)
\subset
\mathbb{Q}(w,i)
$$
it follows that $[\mathbb{Q}(w,i):\mathbb{Q}]$ is even but not a multiple of $4$.
Let $a=\operatorname{Re} w$.
By hypothesis, we have $w=a(1\pm i)$.
Then $a$ is a nonzero real algebraic number, and
$\mathbb{Q}(a,i)=\mathbb{Q}(w,i)$.
Since $a$ is real, we have $[\mathbb{Q}(a,i):\mathbb{Q}(a)]=2$.
Then from the chain
$$
\mathbb{Q}
\subseteq
\mathbb{Q}(a^4)
\subseteq
\mathbb{Q}(a^2)
\subseteq
\mathbb{Q}(a)
\subset
Q(a,i)
=
\mathbb{Q}(w,i)
$$
it follows that
$$
\mathbb{Q}(a^4)
=
\mathbb{Q}(a^2)
=
\mathbb{Q}(a)
$$
else
$[\mathbb{Q}(w,i):\mathbb{Q}]$ would be a multiple of $4$.
But from the identity
$$
w^4
=
-4a^4
$$
we get $a^4\in \mathbb{Q}(w)$, so $\mathbb{Q}(a^4)\subset\mathbb{Q}(w)$.
Then from $\mathbb{Q}(a)=\mathbb{Q}(a^4)$, we get
$a\in\mathbb{Q}(w)$, hence from
$$
w=a(1\pm i)
$$
we get $i\in\mathbb{Q}(w)$, contradiction.
Hence $[\mathbb{Q}(w):\mathbb{Q}]$ must be even.