Why is the black body radiation so important? In the derivation of the black-body radiation formula the assumption is made that the system is an electromagnetic cavity, so that it can be considered in thermal equilibrium.
Leaving aside the fact that I don't see why one would make that assumption (what are its mathematical consequences in the derivation?),
most everyday sources are not in thermal equilibrium, so how can we adjust the black-body radiation formula for them? 
Or is it still applicable?
Also: in a black-body, the spectral energy density is not a constant, which means that some frequencies contribute more to the energy than others: shouldn't we naively expect that each frequency would carry an equal weight? What is the physical meaning of there being "preferred" frequencies?
 A: Blackbody radiation is characteristic of every object in thermodynamic equilibrium and black bodies at constant uniform temperature.
At any temperature objects emit thermal radiation. EM radiation is emitted because inside the object, due to thermal motion of particles charged particles/dipoles start to oscillate, electromagnetic radiation is emitted because of these vibrations. If the object is a black body at constant uniform temperature, the radiation is called blackbody radiation. The energy emitted by any object is always finite with certain distribution over the frequencies with peak at some frequency. We cannot naively expect the energy emitted with all the frequencies carrying equal weight. This is a phenomenon which happens and is observed. This is explained quantum mechanically, infact this led to the development of quantum mechanics.
So a cavity with a small hole with EM radiation inside it is appropriate to study mathematically and is a near perfect blackbody because the hole allows negligible radiation to enter the cavity so that it affects negligibly the thermal equilibrium condition and we can have a very near thermal equilibrium and observe blackbody radiation from it. Rayleigh and jeans couldn't explain blackbody spectrum at higher frequencies, their law predicted infinte spectral radiance at infinite frequencies. Planck gave the solution to the ultraviolet catastrophe(infinite spectral radiance at infinite frequencies) and explained the spectrum of blackbody radiation by assuming the energy of the oscillators inside the cavity to be series of discrete values but not continuous which eventually results in spectral radiance going to zero at higher and infinite frequencies with peak at some frequency.
Radiations emitted by ordinary objects can be approximated as blackbody radiation, they are nearly in thermal equilibrium.
One of the importance is that to know the temperature of a star, the relation between the temperature and wavelength of the peak, called wien's displacement law, evaluated from planck's radiation formula, is used approximating the radiation to be blackbody radiation.
A: 
Leaving aside the fact that I don't see why one would make that assumption (what are its mathematical consequences in the derivation?),

The assumption of cavity is an assumption of physical arrangement for which it is justified to use boundary conditions that are necessary supplement to the equations in order to arrive at the desired results (Rayleigh-Jeans or Planck spectral function).

most everyday sources are not in thermal equilibrium, so how can we adjust the black-body radiation formula for them?

This can be done in terms of emissivity $\epsilon$, which is a number that says how many times is the thermal radiation emitted by an area of the body stronger than the equilibrium radiation of same area of a blackbody. Emissivity is a function of frequency and temperature and is less than or equal to 1.

Also: in a black-body, the spectral energy density is not a constant, which means that some frequencies contribute more to the energy than others: shouldn't we naively expect that each frequency would carry an equal weight?

No, because the range of frequencies is infinite (from 0 to infinity) and the intensity radiated is finite. The only way to distribute finite amount of something over infinite interval is to concentrate it somewhere.
A: Among other reasons stated in the answers and the commments, here is another very important reason for why we care about blackbody radiation:

