"Firmware" is the software in your camera that is stored on a flash memory chip... It runs your entire camera (boots, moves lens, takes pictures, writes the files, etc.).
The Firmware is written by Canon and they do not release the source file (the human readable form) or the "object code" (the form that the camera's computer can read).
Basically what CHDK does is a person figured out how to dump the firmware from the camera (the hard way... by flashing and LED for the data bits in the camera and reading that with a computer). That person then took the code and used a "disassembler" to figure out how the camera works (there are "hints" in the code--variable names, sometimes "function labels" from the original source code and such that give clues).
The CHDK software engineer then created the CHDK program to load on boot and "take over" the main camera code. When you push a button or move a switch, the CHDK code then "calls" the internal camera functions to perform that particular function (say 1/2 press the shutter button). And now that the software engineer has control of the camera, they can write new software to do things that the basic camera firmware does not know how to do (like motion detection, bracketing exposures, etc.).
However, for each camera (and each version of firmware), somebody (a volunteer) has to dump the new code and re-find all of the camera's firmware exact addresses again to include into the CHDK program.