A window manager's task is to do window placement/layout (tiling, overlapping, resizing, ...), add decorations (min/max/close buttons, window menu, pretty title bar, ...), deal with input focus policies (focus follow mouse for instance), and that's about it.
When people refer to desktop environments, they usually mean a window manager plus a set of base applications (taskbar (with widgets), application launch menu, system configuration panel, text editor and basic utilities, etc...).
So a window manager is one part of a desktop environment.