man is not only the command to browse a manual page on a UN*X system, it is also the name of the
nroff (and therefore
groff, too) macros "to lay out the reference pages in this [the UNIX] manual".
man macros exist to typeset the title and section headings of the manpage. Additionally, because it's just a simple text file, other commands such as
whatis peek into the
man-based "source code" for the manpage to fetch their data.
man command is usually a horrible shell script (and it's completely different on every UN*X system!). It generally looks for a preformatted manpage; if it doesn't find one (and if the system has a
*roff command...), it searches
MANPATH for matching manual page, then formats it with a long pipeline. Somewhere in the pipeline you'll always find
... | nroff -man | ...
package coming into play.
gorgonzola points out that the name "
man" is a horrible pun. All
nroff macro packages have names beginning with "
-m" is the switch used to select a macro package, but by punning the name is considered to start with an "
m" -- see
me for more examples.