Go into the console while in TF2 and type either start filename or record filename
You can name the filename anything you want. Been awhile since I did a demo in a valve game, one of those commands should work.
A demo is just a recording of whatever you see ingame. Some people use it to spectate a person and make a demo if they think hes cheating, then later can go back and watch it like a movie to see closer.