CGI (Common Gateway Interface) is the mechanism that connects between computer programs and the Web server.
It allows you to provide a Web-interface to your program, or, in other words, to run your program from a Web browser and get the output as a Web page.
Read more on CGI, Forms and CGI.