Common Gateway Interface. A language independent protocol used by web servers for executing server side programs. CGI programs, often referred to as CGI scripts, are commonly written in Perl, but most other languages, f.ex. Python and C can also be used. CGI is showing its age and is partially replaced by other protocols/interfaces like mod_* and FastCGI.
CGI starts a new process for each request and that normally involves starting a language interpreter, which is a rather large program, and using that to run your script before it shuts down and everythong is removed frm memory until it is loaded again on the next request. So a lot of redundant work is done but the upside is that no memory is used in between requests. This performance bottleneck is the main reason for phasing out CGI is performance but it is still the most available option for running server side scripts in a shared hosting environment.