Most stinky hair odor or smelly scalp is caused by excess bacteria and fungus in the scalp. Almost everyone has some buildup at the hair follicle opening but more importantly they build up inside of the hair follicle. This build can actually gather around the root of the hair.

The scalp fungal treatment and vinegar rinse can be helpful; here is a link to them-

https://justnutritive.com/hair-care-solutions/scalp-problems/

A home remedy that you can try that often works is this-

Shampoo then rinse well with water. Next apply apple cider vinegar to your scalp and hair and wait a few minutes before rinsing well with water.

Follow with a conditioner as needed.