Origin of terms "white dwarfs" and "red giants"? Can someone explain my why "white dwarfs" and "red giants" were so named? And maybe that's a silly question but why not in the opposite way?

@EDIT
Is this somehow co-related with Stefan–Boltzmann law?
The terminology is related to Planck's Radiation Law. We have (from Wikipedia):
$$
{\displaystyle B_{\lambda }(\lambda ,T)={\frac {2hc^{2}}{\lambda ^{5}}}{\frac {1}{e^{\frac {hc}{\lambda k_{\mathrm {B} }T}}-1}}} 
$$
where $ k_B $ is the Boltzmann constant, h the Planck constant, and c the speed of light, $ \lambda $ is the wavelength, and T is the temperature.

A typical white dwarf is very hot, with $ T &gt; 10^5 K $ even. Here let's assume it is about 50,000 K. A typical red giant is of lower temperature than the sun. Let's take it to be about 4,500 K (it will usually be a bit lower). Then we can plot the Spectral Irradiance of both the sources and compare them (I had an older Matlab code).


(The y-axis is $ W m^{-2} sr^{-1} nm^{-1} $.)



For the white dwarf we see that the peak occurs at a significantly lower wavelength than visible light (at about 0.58 nm). Most white dwarfs are hotter so the peak would shift further to the left. Thus, we expect the white dwarf to appear white with a bluish tinge as blue is still marginally higher than the other wavelengths.

For the red giant, the peak occurs at about 640 nm, which is near the red end of the spectrum. Red giants colder than this would have peaks shifted to the right. So they appear orange-red.

As @AtmosphericPrisonEscape already mentioned, dwarf and giant relate to the physical size as compared to the original star in the main sequence.