UNIX is a modular system: it consists of many components so that a user (or system administrator) can choose those components he needs. In particular, there are several layers of software responsible for graphical user interface. These layers are: X Window System, window managers, and desktop environment.
X Window System (also known as X, or X11) is the component of UNIX systems responsible for virtually all basic graphics — in particular, for drawing icons, backgrounds, and windows in which your applications work. Without X, you only have command line. X11 sets the screen resolution and color depth, moves the mouse cursor around the screen, etc. It serves as a foundation for other components of graphical user interface such as window managers and desktop environments.
Window manager extends capabilities of X Window System by placing borders and buttons around windows, which allows the user to move, close, hide or resize the windows. X11 is virtually always used in combination with a window manager, since it would be pretty much unusable without one. There are many window managers available for X11; most popular are fvwm, mwm, kwm (used by KDE), Enlightenment, and Sawfish.
Finally, a desktop environment goes one more step further than a window manager by adding a graphical file manager from which you can drag-and-drop items on your desktop, a panel which can be used to launch frequently used applications, and a set of applications and utilities. There are several desktop environments available for all versions of UNIX; the most popular ones are GNOME, KDE and CDE (soon to be replaced by GNOME).
Most desktop environments contain a window manager as their integral part; for example, KDE contains its own window manager, kwm (it is possible to use KDE with another window manager, but few people do so). GNOME has no window manager of its own; it will allow you to choose any window manager you already have on your system. To make life easier for new users, usually the Sawfish window manager is distributed with GNOME and is used by default; you can switch to another window manager using GNOME Control Center. Note however that you will need a GNOME-compliant window manager to use such features of GNOME as session management, taskbar applet, etc.