The divergence is a consequence of the fact that the vector potential is a sort of "energy", just like the scalar potential; it is an extensive quantity and it scales with the volume of the system.
The energy of something that is constant and infinite is (usually) divergent. Loosely speaking, we are in a situation where
$$
A=\rho_0 L+\text{finite}
$$
where $\rho_0$ is a certain constant and $L$ is the length of the wire, which is formally infinite. This term - in more complex situations - is sometimes called a zero-point energy: a constant shift in the energy which is not measurable and doesn't affect physical predictions.
On the other hand, the magnetic field $\boldsymbol B$ is the derivative of $\boldsymbol A$ with respect to $a$, which is finite, because the $\rho_0 L$ term doesn't depend on $a$ (its derivative vanishes). The magnetic field is finite, as it should be: this object is measurable, unlike $\boldsymbol A$.
The same situation appears when one considers an infinite sheet of charge: there the electric field is finite, but the scalar potential diverges:
$$
\phi=\rho_0 S+\text{finite}
$$
where $S$ is the area of the sheet, formally infinite $S\to\infty$. Again, this is a consequence of the fact that the potential is an extensive magnitude, and it scales with the volume of space.
Some day you'll learn QFT and all these ideas will prove essential in our understanding of Nature.