This is not true. Maybe $$\sum_{n=1}^Na_n=\mathrm{e}^{if(N)}$$ so that $\left|\sum_{n=1}^Na_n\right|$ is bounded (equals $1$). We can easily find $f(N)$ so that $\sum_{n=1}^Na_n$ diverges, but $\sum_{n=1}^N|a_n|^2$ converges. Basically, we want the partial sums to walk along the unit circle taking steps whose absolute value is roughly $1/n$. We could have $f(N)=\ln(N)$ for instance.
To clarify, for $n>1$ this example has
$$\begin{align}
a_n&=\sum_{j=1}^na_j-\sum_{j=1}^{n-1}a_j\\
&=\mathrm{e}^{if(n)}-\mathrm{e}^{if(n-1)}\\
&=\mathrm{e}^{i\ln(n)}-\mathrm{e}^{i\ln(n-1)}\\
&=\mathrm{e}^{i\ln(n)}\left(1-\mathrm{e}^{\ln(n-1)/\ln(n)}\right)\\
&=\mathrm{e}^{i\ln(n)}\left(1-(n-1)^{1/\ln(n)}\right)
\end{align}$$
This difference has absolute value $1-(n-1)^{1/\ln(n)}$. This is smaller than $\frac{1}{n}$ (verified below), so $|a_n|^2<\frac{1}{n^2}$, implying $\sum|a_n|^2$ converges.
To see the inequality holds:
$$\begin{align}
&&(n-1)^{\ln(n)}&< n^{\ln(n)}\\
&\implies&(n-1)^{\ln(n)}&<(n-1)\cdot n^{\ln(n)}\\
&\implies&\left(1-\frac{1}{n}\right)^{\ln(n)} & <(n-1)\\
&\implies&1-\frac{1}{n}&<(n-1)^{1/\ln(n)}\\
&\implies&1-(n-1)^{1/\ln(n)} & <\frac{1}{n}
\end{align}$$