As GDM is GNOME Display Manager but it installs the GNOME desktop also when I replaces it with LightDM So what is the difference between installing GDM or installing Gnome-desktop environment?
gnome-desktop gives you the GNOME desktop environment. You can access it through lightdm desktop manager (Ubuntu's default) even if you don't have
gdm. On the other hand,
gdm is merely login screen. Surprisingly enough, if you do
apt-cache show gdm it reports that gnome-shell is one of the dependencies, but
apt-cache show gnome-desktop reports that gdm is only a recommended package. Why is it so ? I don't know, and probably only the developers can tell you.
lightdm and GDM are both 'display managers'. They govern how and when your 'desktop environment' loads.
Gnome, KDE and XFCE are all examples of desktop environments, and should be compatible with both lightdm and GDM.