His “corpuscular” theory of light was particle-based, and his idea that light was a ray agreed with a wide variety of experiments. Although there was a wave theory of light that was contemporary with Newton’s, put forth by Christiaan Huygens, it couldn’t explain the prism experiments. Newton’s Opticks, like his mechanics and gravitation, was a winner.
But right around the dawn of the 19th century, it started to run into trouble. Thomas Young ran a now-classic experiment where he passed light through a double slit: two narrow slits separated by an extremely small distance. Instead of light behaving like a corpuscle, where it would either pass through one slit or the other, it displayed an interference pattern: a series of light-and-dark bands.
Moreover, the pattern of the bands was determined by two tunable experimental parameters: the spacing between the slit and the color of the light. If red light corresponded to long-wavelength light and blue corresponded to short-wavelength light, then light behaved exactly as you’d expect if it were a wave. Young’s double-slit experiments only made sense if light had a fundamentally wavelike nature.