Fungal infections occur when fungi multiply rapidly on the skin or nails, feeding on keratin and thriving in warm, moist environments.