As John Hughes already mentioned, we require $\nabla \cdot \vec J=0$. Under that restriction, we proceed.
Since the curl of the gradient is zero ($\nabla \times \nabla \Phi=0$), then if
$$\nabla \times \vec B =\mu_0 \vec J$$
for the magnetic field $\vec B$, then we also have
$$\nabla \times (\vec B+\nabla \Phi) =\mu_0 \vec J$$
for any (smooth) scalar field $\Phi$. This means that there is not a unique solution to the problem since $\vec B +\nabla \Phi$ is also a solution for any (smooth) $\Phi$.
However, if we also specify the divergence of the magnetic field (we know that it is zero), then we can pursue a unique solution. For example,
$$\nabla \times \nabla \times \vec B =-\mu_0 \nabla \times \vec J$$
whereupon using the vector identity $\nabla \times \nabla \times \vec B= \nabla ( \nabla \cdot \vec B)-\nabla^2 \vec B$ and exploiting $\nabla \cdot \vec B=0$ gives
$$\nabla^2 \vec B=-\mu_0 \nabla \times \vec J$$
which has solution
$$\vec B(\vec r)=\mu_0 \int_V \frac{\nabla' \times \vec J(\vec r')}{4\pi |\vec r-\vec r'|}dV'$$
where the volume integral extends over all space where $\vec J=\ne 0$. We can integrate by parts in three dimensions by using the vector product rule identity $\nabla \times (\Phi \vec A) = \Phi \nabla \times \vec A+\nabla \Phi \times \vec A$ to write
$$\begin{align}
\vec B(\vec r)&=\mu_0 \int_V \frac{\nabla' \times \vec J(\vec r')}{4\pi |\vec r-\vec r'|}dV'\\\\
&=\mu_0 \int_V \left(\nabla' \times \left(\frac{\vec J(\vec r')}{4\pi |\vec r-\vec r'|}\right) -\nabla' \left(\frac{1}{4\pi |\vec r-\vec r'|}\right) \times \vec J(\vec r') \right)dV'\\\\
&=\mu_0 \oint_S \frac{\hat n' \times \vec J(\vec r')}{4\pi |\vec r-\vec r'|}dS'-
\mu_0 \int_V \nabla' \left(\frac{1}{4\pi |\vec r-\vec r'|}\right) \times \vec J(\vec r') dV'
\end{align}$$
Now, we may extend the integration region to all of space. Then, if $\vec J=0$ outside a finite region, then the surface integral vanishes and we have
$$\begin{align}
\vec B(\vec r)&= -\mu_0
\int_V \nabla' \left(\frac{1}{4\pi |\vec r-\vec r'|}\right) \times \vec J(\vec r') dV'\\\\
&=\mu_0 \int_V \nabla \left(\frac{1}{4\pi |\vec r-\vec r'|}\right) \times \vec J(\vec r') dV'\\\\
&=\nabla \times \left( \mu_0 \int_V \frac{\vec J(\vec r')}{4\pi |\vec r-\vec r'|}dV' \right)
\end{align}$$
where the first equality is effectively the Biot-Savart law and the last equality reveals that $\vec B =\nabla \times \vec A$ for the vector potential
$$\vec A(\vec r) = \mu_0 \int_V \frac{\vec J(\vec r')}{4\pi |\vec r-\vec r'|}dV'$$