Hello,
It can be due to tinea cruris which is a fungal infection of the groin. Treatment consists of topical antifungal cream which may contain miconazole, tolnaftate, terbinafine,ketaconazole and clotrimazole. Restrict wearing any undergarments at night and as far as possible keep the area dry.
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.
It could be jock itch which is fungal. Look up information about it and let me know if that matches what you're experiencing. If so, you can use an antifungal for jock itch. To prevent this a good (and cheap) solution is corn starch.