Because rubber is an insulator.
If you rub a piece of metal on your head (gently of course) any charge it contacts flows through the metal and into your hand. No electricity remains in your hair.
Rubbing your hairs against each other produces static electricity, this is also how clouds make lightning. Since the rubber is an insulator, the charge can’t stay there, and it has to go back into your hair.
Latest Answers