The reason why infection or vaccination should stimulate hair growth is unknown, but most likely the immune system response to the prolonged antigen exposure results in production of cytokines.
Cytokines are chemicals that the immune system uses to communicate between cells.
Cytokines can also affect non-immune system cells such as those in the hair follicles. Cytokines that encourage immune system cells to proliferate may also promote hair follicle cells in the same way. Localized skin inflammation due to allergies or infection can also promote hypertrichosis within the affected area. Barsky S. Acquired localized hypertrichosis. Ann Dermatol Venereol.