Generally speaking, any infection that involves the “territory” drained by the lymph nodes can cause their enlargement. In the case of occipital lymph nodes, this includes any bacterial infection of the scalp, for example, by bacteria found on your fingernails when you vigorously scratch your scalp and break the skin. They are still non-harmful bacteria if the skin is intact, but a broken skin will become a breach of the defenses of your body.
Although bacterial infections are the most common in the scalp, other infections can be present, such as viral infections, but these are much more likely to involve all lymph nodes of the head and neck rather than just the occipital lymph nodes because they are introduced mostly through the nose and mouth. Some parasitic infections as head lice can or scabies cause swollen lymph nodes, especially since they are itchy so they can cause what we call a “secondary bacterial infection” through lesions produced when the person scratches their head. Some fungal infections such as tinea capitis (ring worm) or favus (yellow Sulphur cup) can cause a mixed infection of fungus and bacteria, enlarging the lymph nodes.
Tuberculosis is nowadays quite rare in developed countries, but in those who have an epidemic of malnutrition, especially in Africa, it remains a serious problem. Tuberculosis can enlarge the lymph nodes to the extent of forming an abscess. The worst part is that this abscess can never be drained as an ordinary one, and any attempt of drainage will leave a lifelong unhealed ulcer or an unsightly scar.
The main challenge for the diagnosis of infectious enlarged lymph nodes is that doctors have to locate the origin of infection. Lymph node size is not the main problem and it will most likely subside following proper treatment of the origin. Some infections are hidden and need proper examination and investigations before prescribing an appropriate treatment.