You obtain your first knife once you've met Marvin in the Police Station. There are two ways to use it - hold space to swing it in a zombie's direction or use it as a last effort do avoid damage when a zombie grabs you. Once you have the knife, use it on the next zombie you find. If he/she/it grabs you, try to avoid using the knife on it through instinct, because you won't be able to get it back until the zombie is dead.