Why is Wien's displacement law not discrete? We are taught that the electrons emit electromagnetic waves/photons when transitioning from one quantum level to another in a discrete manner. This is what causes the spectral line of specific elements. However, in my textbook, it says that:

"The energy radiated by a body is electromagnetic radiation and is distributed over an infinite range of wavelengths."

I personally do not see how this is true and how the Wien's displacement law $${\displaystyle \lambda _{\text{peak}}={\frac {b}{T}}}$$ account for different elements and their discrete aspect.
 A: The Wien displacement law (and Planck's law, which fixes the "ultraviolet catastrophe" issue) describe thermal radiation emitted by bodies in thermal equilibrium, not the discrete spectra which result from electronic transitions. Unlike atomic and molecular spectra, thermal radiation is continuous.

How is thermal radiation not a result of electron transitions?

For a fairly intuitive picture, consider photons which are generated by fusion reactions within the sun. For a given reaction - say, $p+p+e^- \rightarrow {^2_1}D + \nu_e + \gamma+\gamma$, the first stage of the proton-proton fusion chain) - two photons whose energies follow a non-Planckian distribution. Those photons then make a very long journey from the core to the surface of the sun. In the process, they scatter off of electrons and ions, both giving and taking energy in random amounts (depending on what they scatter from and at what angle), before finally escaping from the photosphere.
Through this energy exchange, the photon gas rattling around inside the sun comes to thermal equilibrium with the surrounding charged particles (of course, this equilibrium is local, since the temperature within the sun varies considerably with location). The photon energy distribution progresses irreversibly in the direction of increasing entropy, and the distribution with maximal entropy is the Planck distribution. Therefore, if a photon gas is in thermal equilibrium with its surroundings, then its energy distribution is given by the Planck law.
The same principle holds for thermal radiation emitted by any object, not just the sun. Photons scattering around within the object come to equilibrium with its constituent particles before being emitted with a continuous (or approximately continuous) spread of energies. When you see light which has a discrete set of frequencies (such as light emitted from a gas discharge lamp, then that light is not at thermal equilibrium.
