You either have smelly hair, dandruff, or some other scalp condition.
The clearest culprit is oily skin and dandruff flakes on the scalp making everything smell. If you often use products that contain fragrance even if they’re labeled as “fragrance free,” your shampoo might be causing it too. You may also need to adjust washing and conditioning methods if you’ve been using products with a pH level outside what’s typically recommended for healthy hair (pH 4-5). Products with cones which coat the hair shaft can leave behind waxy residues on the surface of your strands and plugs on your scalp that trap moisture and odor – not really great for both physical appearance and odor control!