Nail fungus is caused by bacteria and infections on the skin under the nail.
The nail fungus infection lives under places where it's moist and warm which is your nails. When you wash your hands make sure to dry off your hands and under your fingernails as much as possible and do the same with your toenails.
When washing your feet or getting out of the shower or bathtub make sure to dry your feet really good and dry out the toenail section.
Even run a hair dryer over your toenails to help dry them out if you get toenail fungus. You can do the same with your hands as well.
Nail fungus is contagious and can spread from person to another so be very careful when around others who have nail fungus.