A CGI is just a standardised way of interfacing users on the web with information on a server. It all depends on what technology is being used in the background, for example it could be ASP.NET or Python and SQL Server or MySQL.
If it's a Windows server than it will likely use either Classic ASP, ASP.NET or even PHP. If it is a Linux server then it will likely be Perl, PHP, Python or Ruby or any mix of the above.
First of all you need an IDE (integrated development environment); for Windows web applications have a look at the Microsoft Visual Web Developer Express Edition suite with SQL Server Express (take a Google on these) and if it is the Linux one get a box standard WAMP install to your machine and use something like the Eclipse software as the IDE. The WAMP install will also give you MySQL. You can also nowadays use the Microsoft Web Platform Installer to install all this to your machine for you automatically.
Best place to get started is to visit http://www.w3schools.com/ for tutorials and download the Microsoft Web PI as described above.