This could be balanitis. Balanitis is inflammation of the glans (glands) penis. When the foreskin (or prepuce) is also affected, it is termed balanoposthitis.
Inflammation has many possible causes, including irritation by environmental substances, physical trauma, and infection by a wide variety of pathogens, including bacteria, virus, or fungus—each of which require a particular treatment.
Retract the foreskin daily and soak in warm water to clean penis and foreskin. Apply bacitracin if bacterial infection is suspected.
Apply topical clotrimazole for adult men with probable candidal balanitis.
If the symptoms persist, you would need to consult your doctor.