Gnome and KDE are more than just window managers (WMs): they're desktop environments (DEs), or graphical user environment frameworks. Each consists of a set of libraries and applications designed to work together to produce a feature-rich user interface environment. The Windows equivalent is the Explorer environment, which consists of a set of libraries plus the OS-integrated Internet Explorer rendering engine and a set of default-install applications, though in Windows this is all integral to the total OS install whereas in Linux, Gnome or KDE is simply something you install if you want its functionality and remove (or never install in the first place) if you don't want it.
Gnome is built on a design philosophy in a similar tradition to that of classic MacOS, and KDE is likewise built on a design philosophy in a similar tradition to that of Windows. You can see these similarities in superficial design decisions when you start looking at the differences between Gnome and KDE, and the parallel differences between Windows and classic MacOS. There are other DEs besides Gnome and KDE available for use with the X Window System, and they too are inspired at least in part by the design philosophies of other OSes, generally, though there's no programmatic reason why that has to be the case.
Generally, a DE seems to evolve out of a desire to implement a certain set of useful and convenient GUI functions from an initial starting point of a window manager. A window manager is, in short, just a means of creating a place for application windows to open, a set of minimal behaviors for controlling those application windows, and some guidance for the applications in terms of how their windows should appear. As more and more features are added on top of that, a DE eventually begins to evolve.
Ultimately, the application base and libraries of a DE tend to end up divisible from the standard window manager that goes with a given DE. As such, a mature DE can be coupled with any of a fair number of WMs, so long as those WMs are functionally compatible with the feature set that DE was meant to implement. Sometimes, however, the window manager associated with a given desktop environment doesn't work without that environment, thus creating a one-way divisibility: the DE can be separated from the WM and used with other WMs, but the WM cannot be separated from the DE, and to use the WM with other DEs requires the use of the DE with which it's associated as well. You can add to it, but you can't replace it, in other words.
There are exceptions, however. This will come up as I list some WMs and DEs below:
[b]Gnome[/b]
Gnome is large and "feature-rich" (a synonym for "bloated"). This means that it includes lots and lots of features, and these features are essentially indivisible from the desktop environment. The Gnome window manager is a part of the environment, though it can be "ignored" by implementing another WM with the Gnome libraries and application set running behind it. There is a Gnome window manager spin-off called Metacity, which is the closest you'll get to the Gnome WM existing separately from the DE. It is much less feature-rich, much less bloated, and much more simplified in general. It uses the GTK+ toolkit for GUI design.
[b]KDE[/b]
KDE, the "K Desktop Environment", is also a large, feature-rich graphical user interface environment. It shares much in common with Gnome in terms of its status as a DE and WM pairing: the WM is part of the DE, and can be "covered up" or "ignored" but not really replaced because much of it is part of the basic libraries used to run the DE and its application framework. It doesn't have a WM spin-off as similar to its own integral WM the same way Gnome does in Metacity, but such really isn't needed as there is a "work-alike" window manager already in existence that is simply completely different under the hood, called IceWM. IceWM is blazing fast and feather-light, and is one of the snappiest and quickest WMs available, rivaling minimalist WMs like fvwm, fwm, twm, aewm, and so on for its quick responsiveness and minimal resource footprint. About all it has in common with the integrated KDE window manager is its superficial similarity to the Windows GUI appearance and behavior, and its ability to work well with the KDE libraries and applications. KDE uses the Qt toolkit for GUI design.
[b]XFce[/b]
Usually viewed as a lighter-weight, faster variation on the Gnome idea, XFce is actually another animal altogether, complete with its own window manager, XFwm. Unlike the window managers incorporated into Gnome and KDE, it is a simple thing to run XFwm without the rest of XFce. It is, in that sense, truly modular and orthogonal design, which should appeal to quality programmers. XFce lacks the individuated, easy GUI development tool functionality that Gnome and KDE have, respectively, in the form of GTK+ and Qt (respectively), but for the end user it is faster, just as functional, and almost as featureful. It is also close in lightness, lack of bloat, and snappy, responsive behavior as IceWM. XFwm can be separated from it easily and run with full functional compatibility on top of the Gnome or KDE graphical interface framework. XFce doesn't work quite as well with other WMs as Gnome and KDE do, though -- it is designed for XFwm.
[b]GNUstep[/b]
Whereas Gnome (and to a lesser extent, XFce) is based on a MacOS-inspired design philosophy, and KDE is based on a Windows-inspired design philosophy, the GNUstep framework is based on a NeXTstep-inspired philosophy of functionality. It actually provides significantly unique functionality that doesn't exist with the various DEs and WMs outside of GNUstep. In fact, though GNUstep in many ways fills the same needs as a DE, it isn't one: it's an application framework and GUI development toolkit, all optimized toward implementing NeXTstep-style capabilities and interface look, feel, and behavior. It works in concert with the WindowMaker window manager, though there is nothing to prevent its use with other WMs. The main reason there isn't a lot of credible compatibility between GNUstep and other WMs is that other WMs are simply not flexible enough to adjust to the functionality that GNUstep provides. Whereas XFce and XFwm are somewhat orthogonal with the separation of XFwm from XFce, GNUstep and WindowMaker are actually separate to begin with and are simply seamlessly compatible. Each is its own implementation of NeXTstep design and development philosophy, and each has been adjusted to be as compatible with the other as possible. WindowMaker runs with equal facility on top of the GNUstep framework and the Gnome and KDE graphical user environments. GNUstep can be installed alongside Gnome, XFce, and KDE, and its full functionality can be accessed from within Gnome, XFce, or KDE, but the DE-specific apps with each don't benefit from the additional functionality of the GNUstep environment as much as more independent apps might in a GNUstep-oriented environment. My preferred environment, by a long shot, is GNUstep with WindowMaker. Interestingly enough, WindowMaker (with or without GNUstep) runs about as quickly, with about as much snap and responsiveness, as IceWM. The GNUstep environment is of comparable lightness and lean design with XFce, lacking the bloat and feature-creep of KDE and Gnome; GNUstep favors added flexibility and functionality over added features.
Interestingly, Apple bought NeXT and incorporated in MacOS X the same general application framework and functionality capability that has been implemented in GNUstep. It's extremely easy to develop software that will run on both the GNUstep framework and the MacOS X Cocoa framework, thus allowing for easily ported software. There's even a cross-platform development framework that runs on top of GNUstep called Renaissance, which can be used to produce GUI applications that can be implemented without alteration on either a GNUstep platform or MacOS X (using the Cocoa libraries instead of the GNUstep libraries).
A word of warning, regarding GNUstep: Don't try using it with the expectation that it will not require some adjustment. Moving from Gnome or KDE to GNUstep is about as large an adjustment as moving from Windows or classic MacOS to Linux. It is, after all, a unix-platform implementation of the functionality of a whole different operating system. It'll take some getting used to. Everyone that has decided to give GNUstep/WindowMaker a serious try after seeing me use it, however, has found it increasingly attractive, comfortable, and useful, and has starting thinking of Windows, Gnome, IceWM, and XFwm as being increasingly ugly, unwieldy, and difficult as they got used to it. I don't know if that's because I'm good at finding people who are well-suited to WindowMaker and GNUstep, or if it's something more universal, but that's my experience anyway.
It might also help to know that I use Debian for my desktop and laptop systems, and that the GNUstep system for Debian is extremely well tested, and extremely complete. I don't know how well GNUstep is incorporated into other distros. I imagine it would run beautifully on Slackware or Gentoo, though with something as keyed to a given set of GUI environment options as Mandrake/Mandriva, SuSE, or even Ubuntu or Kubuntu, I'm not sure that things might not be more difficult to adjust to suit.