It's unfortunate that class D amps are called class D since in audio D often stands for digital and the description of how a class D amp works(square waves) sort of sounds digital. Plus class D involves encoding albeit an analog encoding not a digital one.
It's sort of interesting why class D(actually pulse width encoding - variable width square waves of equal height) is class D. And it's stupidly simple. It's the 4th amplifier format defined. The 1st was class A(again not because it's best, just because A comes first in the alphabet). Then class B. Then class C(intermitant amplification and not high fidelity therefore). And the 4th format is class D. In all cases A, B, C, and D stand for nothing; they are just letters.