Two possibilities are there for your symptoms. First of all, hormonal changes may lead 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 a fungal infection causing tinea 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.
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.