Why do some chemicals stain your hands?
Sometimes it is just because they are colored chemicals. If you rub your hands in food coloring, or on grass, or on wet paint, the molecules that make these things absorb light will be left on your hands.
Some molecules are better at sticking to skin than others. You can rub your hands in dark yellow egg yolk, but the dark substance is easy to wipe off with a paper towel. It does not leave a stain. The molecules that make egg yolk yellow are large, and don’t attach themselves to the skin.
Food coloring, on the other hand, is made from very small molecules that can get into the very small crevices and pores in the skin, and they can even react with the skin itself, forming chemical bonds that make them stick tightly there. To wash them off, you need lots of water, to help them dissolve and be carried away, but you may also need to scrub off the top layer of dead skin cells to which the dye has bonded.
Some chemicals react with the skin and change its color. You can burn or bleach the skin with strong oxidizers. Some other chemicals react with the skin and themselves change color. Potassium permanganate (KMnO4) will oxidize (burn) the skin, and make manganese dioxide, which stains the skin brown. Silver nitrate will react with the skin and the salt on the skin to form silver chloride, which will them break down in strong light to form tiny particles of silver. These silver particles stay stuck in the skin, and look black. As the skin grows, and the cells dies and are scrubbed off, the stain gradually goes away.
Nitric acid reacts with (burns) the skin, creating a yellow or brown stain. It is particularly dangerous because the nerves in the skin do not react to it, so you may not realize you are getting burned.