Thanks for your query.Based on the facts that you have posted it appears that you have developed what is termed as Posthatitis.
This could be due to fungal infection Candidiasis
Take some anti fungal medication
like FLucanozole twice daily for 5 days along with some anti fungal gel like Micanozole for local application over foreskin.
Observe proper personal hygiene by cleaning the genitals with warm water twice daily.
It should get cured in a week.