I think Fourier and his contemporaries were looking at the heat equation $u_t = \Delta u$ where $u$ describes distribution of heat on some domain. In a one dimensional case, it would be $u_t = u_{xx}$ on, say, $[-\pi, \pi]$. Physically, we are heating up the wire $[-\pi,\pi]$ from its two ends and the two ends are held at some temperature determined by an external heating device. For simplicity, we may assume they are at $0$ temperature.
A standard procedure to solve this PDE would be to consider $u(t,x) = f(x)g(t)$ for some functions $f$ and $g$. If you plug this back to the heat equation, you arrive at
$ f''/f = g'/g$
But since $f$ depends only on $x$ and $g$ depends only on $t$, the above is a constant, call it $k$. Then we can solve to get $g = Ce^kt$. The other equation is $f'' = k f$, an eigenvalue problem for the operator $\frac{\partial^2}{\partial x^2}$ on $H:=L^2([-\pi, \pi])$. Recall that the inner product on $H$ is
$ (f,g) = \int_{-\pi}^\pi f \bar{g} dx $
Now note that by an integration by part
$ (f'',f) = \int_{-\pi}^\pi f'' \bar{g} dx = f'f \mid_{-\pi}^\pi - \int_{-\pi}^\pi f' \bar{f'} dx $
If we demand $f$ to satisfy $f(-\pi)=f(\pi)$, then we have $(f'',f) = (f',f') \geq 0 $. This tells you that $\frac{\partial^2}{\partial x^2}$ is a positive operator, so its eigenvalues are non-negative.
If $k = 0$, the solutions to $f'' = kf$ are linear polynomials. But they don't satisfy boundary conditions. So $k > 0$. And the solutions to $f'' = k f$ are precisely $A\cos(nt) + B\sin(nt)$ with given boundary condition.
Now to get a general solution to the heat equation, due to linearity of the equation, we expect them to be linear combinations of these trig functions. Thus Fourier write down
$f(x) = \sum A_n \cos(nx) + B_n \sin(nx) $
If we are lucky, and surely we are, all (reasonable) functions can be expressed in this form, so we can solve the heat equation.