A lot of things can cause this issue, but I'd have to guess that the most common would be infection. Bacteria gets under the skin and inflames it. Or possibly injury.
If you have been working hard or working out strenuously, this can happen. Also, it could need to be cleaned because bacteria can collect in that area causing infection.
There are a number of conditions. Balanitis, Paraphimosis, Phimosis, Penile candidiasis, possible urethral infection, potential infection from not cleaning properly, if masturbation takes place it could be handled to roughly.