codecs = compression decompression
Basically it is a method of compressing data for video purposes. There are a ton of codecs out there.
Also, *.avi, *.mpg/mpeg etc. all refer to the file type not necessairly which codec is being used. There are many different codecs that are used for avi's - it all depends on the company that produces the video.
The bottomline with codecs is that over time they develop new ones so quality of the video can be increased with a smaller file size. The more they can compress the data, without losing quality, the better. You can thank the online industry for the development of high quality streaming video.
Also, some codecs are proprietary, for example Apple's codecs for their mpeg4 can only be played on their Quicktime. Same for Real Player. The best files and codecs are ones I can play on any system. For example the generic Indeo AVI codec can be played on MS Media Player, Quicktime and Realplayer.
Unless you are making commercial quality videos/internet videos you really need not worry about codecs. The biggest pain is sometimes I download videos and I cannot get he video to work - or I have to find the codec and install it. For example, some videos use the DIVX codec and you need to go to the DIVX site to obtain it.