Usually, nail fungus happens when fungus gets in your nail through a small trauma (cut or break) to the nail. It's not caused by poor hygiene. Nail fungus can be spread from person to person. It may be hard to determine exactly where or how you got the fungal infection. But warm, wet places like a locker room are good spots for a fungus to grow.