Thickened, discolored toenails and fingernails are often due to a fungal infection of the nail bed (the skin beneath the nail), matrix (where the growth of the nail begins), or nail plate (the nail itself) caused by a fungus called Trichophyton rubrum.