To record a game, type in console record 'name', while the file name shouldn't have any special characters or spaces. These functions are provided via console commands or GUI tools like the Demo Playback window, Demo Editor and Demo Smoother.
The Source Engine provides a set of tools to record a game to a demo file for possible editing and later playback.