this is balanitis.
all i can do is tell you my experience.
went to out of hours dr, who was ready to send us to casualty with a letter, he rang first and they said (reading between the lines of hearing only half, his side, of the convo) f&*k off give him antibiotics first.
which he did and we duly took them (i'm lentil weavy so it was the first and last time ds has had anti-b's).
swelling went down. went to our homeopath, she asked 'have they told you how to prevent this happening again?' i said 'no', she sighed in exasperation and told us every night in the bath to EXTREMELY GENTLY pull ds's foreskin back NOT FORCING IN ANY WAY and wiggle it around in the water to clean it.
we've done this and had not a problem since, and thinking back, ds was prone, as he had had red and sore penis before then loads of times. not a sausage (sorry ) since we've been cleaning him like that, he is 4 now and does it himself.
loads of people will now post on here telling me that you're not meant to pull the foreskin back and that it retracts naturally. of course that's right. this is not about forcing the foreskin back, this is about gently letting water get to where the shit and piss is trapped and washing it out. REALLY REALLY GENTLY.
and it works. and it avoids circumcision, well it did in our case.
hth.