What does the letter D on the underside of the wing stand for?
It stands for Deutschland. And the 366 is the remainder of the registration. The 'D' is the prefix to aircraft registered in Germany, think of it as an international license plate. The pre-1928 allocation was D-nnnn (max four digits).

Registration prefixes do not always have a clear meaning though.

For the placement, see here: Are the size and location of the registration number regulated?