The series on the left is a Riemann sum approximation for the integral on the right.

That is exactly what the Gibbs phenomenon says: where a function has a jump discontinuity, the Fourier series will overshoot as it approaches the discontinuity. As the number of terms in the Fourier series increases, the amount of overshoot will converge to a constant percentage (approximately 17.9) of the amount of the jump.