The striking surface of the matchbox contains red phosphorus and the head of the matchstick contains potassium chlorate. So when the matchstick is rubbed on the matchbox, some of the red phosphorus is converted to white phosphorus, a chemical i.e. so volatile that it ignites in air.