A helmet protects your brain when you fall. It has a thin shell on the outside and thick foam inside. It has a strap to keep it on when you fly through the air. It only covers your head, and the rest of your body is exposed. So you still have to be careful.
The foam crushes when you hit the road. That cushions the blow, and usually saves your brain. The shell makes it skid on the street so your neck does not get jerked. The shell also keeps the foam in one piece. The straps keep it on your head.
If the strap is not right, your helmet can slip to the side or to the back. Then your bare head can hit the road. Ouch. Pavement is very very hard.