Planck was very reluctant against his own discovery. As a very conservative men he tried for the rest of his life to somehow describe his radiation law from classical physics.
The history is very interesting: The question about the correct blackbody radiation law, which was known to be a universal function of temperature alone, i.e., independent of the material of the cavity walls. That's and because it's about thermodynamics is, why Planck got interested in it in the first place. He already investigated the problem for many years before 1900. The breakthrough came in this year, because at the Physikalisch Technische Reichsanstalt Kurlbaum et al measured the black-body spectrum over a large interval of wavelengths and at various temperatures. Their motivation was to find an accurate measure for the luminosity of all kinds of light sources (gas as well as the very new electric lightning), and there the black-body radiation is an ideal candidate, because it's universal. Planck's first paper, delivered at the academy of sciences, was phenomenological. Ingneously he interpolated between two expressions for the entropy leading to the Raleigh-Jeans and the Wien law for low/high frequencies, from which the correct radiation law, valid for all frequency ranges followed. Then he wanted to get a theoretical derivation from Maxwell electrodynamics and thermodynamics. In his earlier works he already worked out the idea that he can use the most simple model for the container walls, i.e., harmonic oscillators and investigated the exchange of radiation energy with these oscillators. Then he used (also reluctantly, because he was rather a proponent of the phenomenological thermodynamics than of kinetic theory a la Boltzmann) statistical physics to get the radiation law. The ingenious idea indeed was to first "quantize the energy". From the generally valid Wien-displacement law it's clear that the energy quanta must be in multiples of ##\hbar \omega## (where ##\hbar## is the modern name for his new fundamental constant, the quantum of action; he rather wrote ##h f##). The other ingenious idea was to use a stochastics of how to distribute wave modes over the oscillators to count the microstates, thereby introducing the famous formula ##S=k_{\text{B}} \ln \Omega##, in a way we call today "Bose-Einstein statistics". Of course his idea was to make the discrete energy quanta continuous again at the end of the calculation, but he found that he only got the correct radiation law leaving the energy quantized in the specific way he did, based on the Wien displacement law. Reluctantly Planck accepted the finding that electromagnetic energy of radiation at a certain frequency seems to be exchanged with matter in discrete quanta of the size ##\hbar \omega##, but he never accepted Einstein's light-quanta hypothesis.
In a sense Planck was right, seen from the modern perspective, where we have (cavity) QED at hand. Einstein's idea that light quanta can be interpreted as localized point-like particles is flawed in any respect. Particularly in the case of black-body radiation when realized as thermal radiation within a cavity that's a completely wrong picture, but the photons describe quantized energy eigenmodes of the quantized electromagnetic field, and these eigenmodes lead not to locally peaked energy-density distributions but these are spread over the entire cavity.