Fungi that are already present in or on your body can cause nail infections. If you have come in contact with someone else who has a fungal infection, it may have spread to you. According to the American Academy of Dermatology (AAD), fungal infections affect toenails more commonly than fingernails because your toes are usually confined to your shoes, where they’re in a warm, moist environment.

Occlusive shoe materials, such as vinyl, which cause the feet to remain moist, provide an excellent area for the fungus to proliferate. Likewise, absorbent socks like cotton that wick water away from your feet may help. Some individuals who sweat excessively benefit from the application of antiperspirants like 20% aluminum chloride (Drysol). Powders can help keep your feet dry. Although counterintuitive, if your feet can be soaked in a solution of aluminum acetate (Burow's solution or Domeboro solution) and then air dried with a fan, this can be very helpful if performed three or four times within 30 minutes. A home remedy of dilute white vinegar soaks, using one part vinegar and roughly four parts water, once or twice a day (as 10-minute foot soaks) may aid in treatment followed by evaporation can be helpful.
The medical name for fungal athlete's foot is tinea pedis. There are a variety of fungi that cause athlete's foot, and these can be contracted in many locations, including gyms, locker rooms, swimming pools, communal showers, nail salons, and from contaminated socks and clothing. The fungi can also be spread directly from person to person by contact. Most people acquire fungus on the feet from walking barefoot in areas where someone else with athlete's foot has recently walked. Some people are simply more prone to this condition while others seem relatively resistant to it. Another colorful name for this condition is "jungle rot," often used by members of the armed services serving in tropical climates.
Toenail fungus is an infection that gets in through cracks in your nail or cuts in your skin. It can make your toenail change color or get thicker. It can also hurt. Because toes are often warm and damp, fungus grows well there. Different kinds of fungi and sometimes yeast affect different parts of the nail. Left untreated, an infection could spread to other toenails, skin, or even your fingernails.