The solution appears in many textbooks (including my own). I will do the $2$-dimensional case here, but the $n$-dimensional case is only notationally a bit more complicated. I work on a region that is star-shaped with respect to the origin. (The result is false without some topological restrictions.)
We are given a $C^1$ vector field $\vec F = (P,Q)$ with $\dfrac{\partial Q}{\partial x} = \dfrac{\partial P}{\partial y}$. We consider the path $\vec g(t) = t(x,y)$, $0\le t\le 1$, from $(0,0)$ to $(x,y)$. Then $\vec g{}'(t)=(x,y)$. Define
$$\Phi(x,y) = \int_0^1 \vec F(\vec g(t))\cdot\vec g{}'(t)\,dt = \int_0^1 \big(P(tx,ty)x + Q(tx,ty)y\big)dt.$$
Now let's calculate $\dfrac{\partial\Phi}{\partial x}$. We differentiate under the integral sign (1), we use the chain rule and then the curl hypothesis (2), and at the end we use the chain rule (3), integration by parts, and the Fundamental Theorem of Calculus (4):
\begin{align*}
\frac{\partial\Phi}{\partial x} &\overset{(1)}= \int_0^1 \frac{\partial}{\partial x}\big(P(tx,ty)x + Q(tx,ty)y\big)\,dt \\
&= \int_0^1 \big(P(tx,ty) + tx\frac{\partial P}{\partial x}(tx,ty) + ty\frac{\partial Q}{\partial x}(tx,ty)\big)dt \\
&\overset{(2)}= \int_0^1 \big(P(tx,ty) + tx\frac{\partial P}{\partial x}(tx,ty) + ty\frac{\partial P}{\partial y}(tx,ty)\big)dt \\
&\overset{(3)}= \int_0^1 \big(P(tx,ty) + t\frac d{dt}P(tx,ty)\big)dt \\
&\overset{(4)}= \int_0^1 P(tx,ty)\,dt + tP(tx,ty)\Big]_{t=0}^1 - \int_0^1 P(tx,ty)\,dt \\
&= P(x,y),
\end{align*}
as required. The other partial derivative follows analogously.