The great thing with blackbody radiation in the sense studied by Planck is that it doesn't matter where it comes from. It's radiation in thermal equilibrium with the cavity walls it is confined to. The only thing you need to know that the cavity walls consist of electrically charged particles that are somehow bound within the walls and that electromagnetic fields make the charges wiggle around as well as that wiggling (i.e., accelerated) charges emit electromagnetic waves. Thus the electromagnetic radiation gets absorbed and emitted all the time. In thermal equilibrium the wiggling of the charges is maximally randomized, and if also the radiation within the cavity is in thermal equilibrium with the walls the emission and absorption rates are equal, i.e., there's no net exchange of energy between the radiation field and the walls. This equilibrium situation reflects the most random state (maximum-entropy state) given the contraint of energy conservation, which is embodied in the thermo-statistical treatment of the problem by the temperature of the walls and radiation field.
This was well known when Planck started to attack the problem in the late 1880ies. I.e., he could model the walls as an ensemble of harmonic oscillators exchanging electromagnetic radiation. Around 1900 he also got new high-precision input from a very careful measurement of the black-body spectrum as a function of temperature by Lummer and Kurlbaum at the Physikalisch Technische Reichsanstalt (PTR), who undertook this endeavor to get a well-calibrated measure for the luminosity of light for engineering the lightning (particularly the upcoming electric light bulbs in this time).
As is well known, Planck first got an empirical formula interpolating the older attempts (Wien vs. Rayleigh-Jeans) which turned out to be only correct in the long-wavelength and the large-wavelength limit but not over the whole spectral range. A bit later Planck tried to get his empirical formula from first principles of thermodynamics (his true field of expertise) and electromagnetic theory (Maxwell's equations), using (reluctantly!) the methods of statistical mechanics a la Boltzmann and Maxwell, which he didn't appreciate much at the time. Using a mathematical trick by Boltzmann "quantizing the energy" he figured out that he had to quantize the absorption and emission energies of the radiation field with his model-matter oscillators as to exchange "energy packets" of the size ##\hbar \omega## (written in modern terms using the modified Planck constant ##\hbar##), where ##\omega## is the frequency of the radiation. To his surprise he got the right formula by using this assumption and counting the number of ways to distribute of the total energy of the radiation field in the cavity in corresponding microstates, and that one must not take the continuum limit of energy exchange, which was his final goal since in classical electrodynamics the radiation energy should be absorbed and emitted in a continuous way, but he had to keep his "energy quanta", i.e., ##\hbar## finite to fit the black-body spectrum found by the PTR researches with high accuracy over the complete range of the spectrum.
The rest is then a known story. After some confusion (called the "old quantum theory") finally in 1925/26 the physicists discovered modern quantum theory, including also relativistic quantum field theory, although it should take another 20 years to make sense of the divergent higher-order quantum corrections in terms of renormalization theory, which indeed was fully understood only at the end of the 1960ies and early 1970ies with the work by Bogoliubov, Parasiuk, Hepp, and Zimmermann who developed the systematics of renormalization using Feynman diagrams and 't Hooft's and Veltman's proof of the renormalizability of gauge theories. This is the best and only valid theory we have about matter and radiation today. Particularly photons cannot be adequately described by any other model than relativistic QFT itself.