Fungal infections around the body are quite rare but what is even more of a medical nuance would be a fungal infection on the surface of the penis. Although the underlying cause of what caused the infection in the first place can vary, most of the time, there is an underlying disorder of your skin that allows the infection to develop in the first place.
Consider the skin to be our armor against most bacteria, viruses, and fungi that want to enter our bodies to grow. Most of the time, the skin is all that we need to prevent these infections from ever becoming problematic. The skin has a complex system of immune defense strategies to prevent the growth of any of these foreign agents. When there is an underlying problem with the integrity of the skin, however, the immune defenses are not functioning to their full capacity. Even slight lapses like superficial wounds or problems with the histology of the skin layers could lead to pores allowing for infections to begin.
Fungal infections on the penis are likely due to this type of pathology. One of these conditions goes by the name of Pyoderma Gangranosum. It is idiopathic inflammation of the underlying skin that can lead to small ulcers that form on the surface of anywhere affected. Even if these outbreaks are more likely on other parts of your body considering the fact that there is more surface area elsewhere than on your penis, if you are unlucky, this is where an outbreak can occur. Patients with this condition need to meet with their dermatologists in order to diagnose and treat the condition. Doctors will need to perform a histological examination and take a few samples of the surface skin and examine the wounds to rule out other potential cases. A treatment of oral steroids will be the likely outcome for the patient in order to reduce the immune system from creating more wounds. 
An unfortunate "Catch-22" here is that when you are taking steroids to reduce your immune system-caused infection, the steroids actually mute your immune response to other infections as well. It is not unheard of where a patient will be taking steroids and notice an outbreak of Candida infections. Although these are bacterial infections, opportunistic fungal infections can also occur during this infection so you may even have a fungal infection after treatment begins.
Another potential cause could be from sexual intercourse with a partner having a fungal infection. In theory, having sex with someone with an active fungal infection could lead to a superficial fungal infection because of poor postcoital hygiene. As long as a patient practices proper hygiene after sex like by washing their penis with soap afterward, it is unlikely to have a fungal infection that occurs from this type of cause.
Regardless of the causes, the best thing for you to do is go to a dermatologist to have your fungal infection adequately examined and treated.
Still have something to ask?
Get help from other members!