Hello,
It can be due to seborrheic dermatitis or fungal infection. Topical antifungals and mild steroids are the usual treatment and combination of the two can be used to treat stubborn patches. Oral antifungal drugs and immunomodulators such as tacrolimus and pimecrolimus are used in very severe cases.
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 doctor. I sincerely hope that helps. Take care and please do keep me posted on how you are doing.
Tinea cruris. Antifungal cremes help.