Since a good proof of this on MathOverflow has already been linked in the comments, I will provide an alternate and original proof.
Firstly, note that we may write $f(x)=x^r g(x)$ for some monic $g(x)\in\mathbb{Z}[x]$ with no roots at $x=0$.
Let $n=\deg(g)$, and let $\alpha_1,\cdots,\alpha_n$ be the roots of $g(x)$. Define the sequence
$$A_k=\alpha_1^k+\alpha_2^k+\cdots+\alpha_n^k$$
It is a fact that the fixed field of the Galois group of a splitting field of a polynomial in $\mathbb{Q}[x]$ is $\mathbb{Q}$, so since $A_k$ is fixed by every automorphism in $\text{Gal}(\mathbb{Q}(\alpha_1,\cdots,\alpha_n)/\mathbb{Q})$, then $A_k\in\mathbb{Q}$. Furthermore, since $\alpha_i$ are algebraic integers, then so is $A_k$, and since $A_k$ is also rational, then it must be an integer. (note that this fact can also be proven by combining of Newton's identities and Vieta's formulas)
Now, note that since $|\alpha_i|\leq 1$, then
$$|A_k|\leq |\alpha_1|^k+|\alpha_2|^k+\cdots+|\alpha_n|^k\leq n$$
Combined with the fact that $A_k$ is an integer, this means that $A_k$ only takes on finitely many values. Writing, $g(x)=x^n-b_{n-1}x^{n-1}-\cdots-b_1x-b_0$, we know that $A_k$ satisfies the linear recurrence
$$A_k=b_{n-1}A_{k-1}+\cdots+b_1A_{k-n+1}+b_0A_{k-n}$$
Since $A_k$ satisfies a linear recurrance and takes on only finitely many values, then $A_k$ is periodic with some period $m$. This means that $A_{mk}=A_0=n$ for all $k\geq 0$. Therefore, for $|x|<1$, we have that
\begin{equation}
\begin{split}
\frac{n}{1-x}&=\sum_{k=0}^\infty nx^k\\
&=\sum_{k=0}^\infty A_{mk}x^k\\
&=\sum_{k=0}^\infty \sum_{i=1}^n \alpha_i^{mk}x^k\\
&=\sum_{i=1}^n\sum_{k=0}^\infty\alpha_i^{mk}x^k\\
&=\sum_{i=1}^n\frac{1}{1-\alpha_i^mx}\\
\end{split}
\end{equation}
and therefore, multiplying both sides by $1-x$, and taking the limit as $x\rightarrow 1^-$, we have that
\begin{equation}
n=\lim_{x\rightarrow 1^-}\sum_{i=1}^n\frac{1-x}{1-\alpha_i^mx}\\
\end{equation}
Notice that if $\alpha_i$ is an $m$-th root of unity, then
$\lim\limits_{x\rightarrow 1^-}\frac{1-x}{1-\alpha_i^mx}=1$
, and otherwise $\lim\limits_{x\rightarrow 1^-}\frac{1-x}{1-\alpha_i^mx}=0$. Combining this with the formula above tells us that $g(x)$ has precisely $n$ roots $\alpha_i$ which are $m$-th roots of unity (this is every root of $g(x)$).
Equivalently, every root of $f(x)=x^r g(x)$ is either $0$ or a root of unity, as desired.