Documents are static files on the system. They can be HTML, text, binary data (images, sounds, etc.)
CGI programs (Common Gateway Interface) are executable programs on the server machine. The are executed on the clients behalf by the HTTP server.
CGI is a defined specification for how an HTTP server executes and communicates with programs.