The dust on butterfly and moth wings are modified hairs called scales. The scales have at least 4 functions, not necessarily on the same butterfly species:
(1) They form patterns of bright colors, sometimes with hidden ultraviolet pattern, that are used as signals to the other sex in attraction for mating.
(2) The bright colors are used to advertise particular butterfly's bad tastes to predators. This protects them from being eaten.
(3) The scales may form patterns that help the butterflies blend into their background and thus escape being eaten by birds or other animals by background resemblance.
(4) Dark colors formed by the scales can be used by butterflies to soak up warmth from the sun that allows their bodies to warm up to flight temperatures in cool seasons or cool environments. Remember: butterflies are cold-blooded.
For more information, see: Why do some butterfly and moth wings have such brilliant colors?