Let f(x,y) be any function of two variables and assume that x and y are themselves functions of some variable, t. Then we could write f as a function of the single variable t and, by the chain rule, df/dt= (\partial f/\partial x) dx/dt+ (\partial f/\partial y)dy/dt. In terms of "differentials" that is df= (\partial f/\partial x)dx+ (\partial f/\partial y)dy.
An expression of the form M(x,y)dx+ N(x,y)dy is an "exact differential" if and only if there exist a function f such that \partial f/\partial x= M(x, y) and \partial f/\partial y= N(x, y). Of course, if that is true, we have \partial M/\partial y= \partial^2 f/\partial x\partial y and \partial N/\partial x= \partial^2 f/\partial y\partial x. But those "mixed second partial derivatives" must be equal so to be an "exact differential" we must have \partial M/\partial y= \partial N/\partial x
Here, N= x^2- y^2 so that \partial N/\partial x= 2x. We must have \partial M/\partial y= 2x so that, integrating with respect to y while holding x constant, we have M= 2xy+ f(x). "f(x)" is the constant of integration- since we integrate with respect to y while holding x constant, that "constant of integration" can be any function of x.