Your head is still accelerating from moving to not-moving, yes. However, a helmet can slow that down by providing a cushion. The helmet stops first, then your head, by compressing the foam inside the helmet, slows down more gradually.
Remember that force is mass times acceleration. By reducing the acceleration that your head/brain is experiencing, you are exerting less force on the brain. Less force means that there’s less jostling and less damage, since most tissues can withstand some amount of force/strain/stress before they are damaged.
Latest Answers