The Lagrangian for the problem is
$$L(x,y,\lambda)=f(x)+g(y)+\lambda[xf(x)+yg(y)-B]$$
Let us assume that there is a solution of the optimization problem and that it is a critical point of the Lagrangian.
The critical point(s) satisfy:
$$L_x=f'(x)+\lambda[f(x)+xf'(x)]=0\tag{1}$$
$$L_y=g'(y)+\lambda[g(y)+yg'(y)]=0\tag{2}$$
$$L_\lambda=xf(x)+yg(y)-B=0\tag{3}$$
Suppose $\lambda=0$. There may be a critical point satisfying $f'(x)=g'(y)=0$ and $xf(x)+yg(y)=B$.
Suppose $\lambda\neq 0$. Then rearranging $(1)$ and $(2)$ and dividing the former by the latter, gives
$$\frac{f'(x)}{g'(y)}=\frac{f(x)+xf'(x)}{g(y)+yg'(y)}.$$
Solving for $y$:
$$y=x+\frac{f(x)}{f'(x)}-\frac{g(y)}{g'(y)}$$
Substitute into $(3)$ and solve to get:
$$x=\frac{Bf'(x)g'(y)+g(y)[f'(x)g(y)-f(x)g'(y)]}{[f(x)+g(y)] f'(x)g'(y)}$$
and
$$y=\frac{Bf'(x)g'(y)+f(x)[f(x)g'(y)-f'(x)g(y)]}{[f(x)+g(y)] f'(x)g'(y)}$$
which may be another critical point (assuming I did not divide by zero somewhere).