The type of skin cancer that affects the nails is called melanoma. Melanoma begins in the cells that give the skin color. These cells are called pigment cells. This is why skin cancer that begins under the nails causes the nails to change color.