A sufficient condition for a periodic function to be representable as a Fourier series are the so called Dirichlet conditions:
$f$ must be absolutely integrable over a period.
$f$ must have a finite number of extrema in any given bounded interval, i.e. there must be a finite number of maxima and minima in the interval.
$f$ must have a finite number of discontinuities in any given bounded interval, however the discontinuity cannot be infinite.
But these conditions are known not to be necessary. What is an example function violating these conditions, which still has a Fourier series representation?
Dirichlet conditions came up before the concept of a function of bounded variation existed. The BV property is what is really needed for the proof of Dirichlet's theorem to work. See Pointwise convergence of Fourier Series of functions of bounded variation
So an easy answer to your question is: take a continuous function with an infinite number of extrema but of bounded variation. For instance, $$ f(x) = \sin x\, \sin \log x\qquad 0\le x\le 2\pi $$ extended periodically. It looks reasonable:
but there are infinitely many extrema near $0$, as one can see from the derivative
$$f'(x) = \frac{\sin x}{x}\cos \log x + \cos x\,\sin \log x\approx \cos \log x + \sin \log x $$ which changes sign infinitely often as $x\to 0^+$.
The derivative is bounded, and so $\int_0^{2\pi} |f'(x)|\,dx$ is finite, which implies $f$ is a BV function.