Not everyone did think light was a wave. Early in the 19th century, it was heavily debated. One experiment that convinced most people was the double slit experiment. Shining light through two narrow slits showed interference in the light. This is a property of waves, not particles.

This article goes into some more details on what inspired Thomas Young to do the experiment and provides some of the arguments for light being a particle. Reminder, light is a wave, but it is also a particle.
If you are specifically wondering how they proved light is an electromagnetic wave, That credit goes to Michael Faraday.
(He) discovered that the plane of polarization of linearly polarized light is rotated when the light rays travel along the magnetic field direction in the presence of a transparent dielectric, an effect now known as Faraday rotation.
That is what inspired Maxwell to do his experiments and studies on electromagnetic light.