Nail fungus occurs when fungi invade the nail bed, typically starting at the tip of the nail and working its way deeper. The infection often causes the nail to become discolored, yellow, or white. It can also cause the nail to thicken, become brittle, and even crumble.