Immunological factors for the cause of headaches following SAR-CoV-2/COVID vaccination
Headache is one of the various side-effects of vaccination. Typically, a person will have pain in the site of injection, muscles throughout your body and head.
The immunological reason is the network of our immune system. Whenever a foreign antigen (vaccine) is detected by our immune system, antigen-presenting-cells (macrophages, dendritic cells) takes the antigen to nearest lymph nodes where it is presented to the adaptive immune system. Due to this invasion, strong immune response starts which leads to the pain.

Image Source: wikipedia.org/wiki/Lymphatic_system