Hint: Presumably, you're comfortable with the following statements:
$$\frac{d}{dx}(bx^2)=2bx\qquad\qquad \frac{d}{dx}(cx)=c$$
Thus, if I say that $\frac{d}{dx}(f)=6x$, you know that $f=3x^2$ (potentially with a constant term added on, e.g., $f=3x^2+17$ also works). Remember that for the purposes of differentiation with respect to $x$, the symbol $y$ is a constant. Thus, because $f_x=x+2y$, we must have that
$$f=\tfrac{1}{2}x^2+2xy+(\textsf{some expression only involving }y\textsf{ and constants})$$
I'll leave it to you to finish the work though.