to excess oil produced by the oil glands in your scalp. This causes the harmless bacteria that live in the scalp to proliferate and feed off the oil, which produces the odor.
Second possibility is of contact dermatitis or an allergic reaction
capitis. It is contagious and can spread direct contact with someone who has the condition, or if you touch contaminated items such as combs, hats, clothing, or similar surfaces. Diagnosis is by clinical examination of the scalp as well as a skin lesion biopsy with microscopic examination. Anti-fungal medications, taken by mouth, are used to treat the infection.
It is important to keep the area clean. A medicated shampoo, such as one containing selenium sulfide like selsen may also help.
It is very difficult to precisely confirm a diagnosis without examination and investigations and the answer is based on the medical information provided. For exact diagnosis, you are requested to consult your dermatologist. I sincerely hope that helps. Take care and please do keep me posted on how you are doing.