From Wikipedia
The electrostatic potential energy, UE, of one point charge q at position r in the presence of an electric field E is defined as the negative of the work W done by the electrostatic force to bring it from the reference position rref[note 1] to that position r.1[2]:§25-1[note 2]
Since the potential energy is defined as negative of work done by the conservative force. I will proceed with the proof by calculation work done by the force in bringing the point charge q from $\infty$ to $r$.
I have used $dx$ instead of $ds$ as depicted in the diagram.
$$W=F_{Qq}\cdot dx$$
Since the direction of the force by Q on q ($F_{Qq}$) is antiparallel the dot product is resolved as
$$W=F_{Qq}\times dx \cos(180^{\circ})$$
$$W=-F_{Qq}\times dx$$
Now, subbing in the value of $F_{Qq}= \frac{k Qq}{x^2}$
$$W=-\int_{\infty}^{r} \frac{k Qq}{x^2}dx$$
$$W=\bigg[\frac{kQq}{x}\bigg]_{\infty}^{r}$$
$$W=\frac{kQq}{r}$$
Since this is the work calculated therefore potential energy is its negative:
$$U=-\frac{kQq}{r}$$
However the correct expression for the potential energy of two point charges is
$$U=\frac{kQq}{r}$$
I can't find anything wrong with my proof but it is wrong, why?