These organisms are especially likely to multiply and cause inflammation if moisture is allowed to persist under the foreskin for a while. This may occur if you have not washed for a couple of days, or sometimes after sexual activity (vaginal, oral or anal - with or without a condom).
Balanitis is not sexually transmitted. It results from an overgrowth of organisms which are normally present on the skin of the glans. The condition most commonly occurs in men who have a foreskin (i.e. have not been circumcised). The environment under the foreskin is warm and moist, and these conditions often favour the growth of the organisms that cause balanitis.
One common organism associated with balanitis is a yeast known as Candida albicans. Balanitis may occur because of excessive growth of Candida, due to moisture and warmth under the foreskin.