What is the history of fourier series?

It is quite complicated, and starts before Fourier. Trigonometric series arose in problems connected with astronomy in the 1750s, and were tackled by Euler and others. In a different context, they arose in connection with a vibrating string (e.g. a violin string) and solutions of the wave equation.

Still in the 1750s, a controversy broke out as to what curves could be represented by trigonometric series and whether every solution to the wave equation could be represented as the sum of a trigonometric series; Daniel Bernoulli claimed that every solution could be so represented and Euler claimed that arbitrary curves could not necessarily be represented. The argument rumbled on for 20 years and dragged in other people, including Laplace. At that time the concepts were not available to settle the problem.

Fourier worked on the heat equation (controlling the diffusion of heat in solid bodies, for example the Earth) in the early part of the 19th century, including a major paper in 1811 and a book in 1822. Fourier had a broader notion of function than the 18th-century people, and also had more convincing examples.

Fourier's work was criticised at the time, and his insistence that discontinuous functions could be represented by trigonometric series contradicted a theorem in a textbook by the leading mathematician of the time, Cauchy.

Nonetheless Fourier was right; Cauchy (and Fourier, and everyone else at that time) was missing the idea of uniform convergence of a series of functions. Fourier's work was widely taken up, and also the outstanding problems (just which functions can be represented by Fourier series?; how different can two functions be if they have the same Fourier series?) were slowly solved.

Source: Morris Kline, Mathematical Thought from Ancient to Modern Times, Oxford University Press, 1972, pages 478-481, 502-514, 671-678,and 964.