In a car crash the car decelerates really quickly. If there is no air bag your head continues to travel at the same speed as before until it hits the dash board and decelerates really quickly upon impact, since Force= mass x acceleration (F=ma), this results in a large force being applied to your head which is very damaging.
An airbag puts a soft material between your head and the dashbord which causes your head to decelerate over a longer time and so at a slower rate this causes the force on your head to decrease which makes injury less likely or less severe