Window Managers (WM) are exactly what they sound like: They manage windows. This means that while the X server provides the basic functionality to have windows, this is in turn utilised by the various window managers, to actually draw these windows, and manage their placement on the screen (i.e. is it full-screen or minimised, or just an average window, and if so, where is it). Additionally, the WM draws the window borders, window controls (buttons, menus), desktop icons, and similar “widgets”.
There are many types of Window Manager, which all differ in appearance and functionality. You would most probably not worry too much about WMs, as the major Desktop environments (see below) come with their own WMs, or a WM they are built upon and provide that functionality out of the box.