The Illinois State Museum site says this:
The dogbane leaf beetle has a special type of color that shines and changes as the insect changes position or as we change position while looking at it. This changing color is called iridescence. The beetles' iridescence is produced by special body structures and light. The surface of the body parts of this beetle is made up of stacks of tiny, slanting plates, under which is a pigment (substance that produces color). Some light rays reflect from the surface of the plates, and other light rays reflect from the pigment underneath. At different angles, the light reflects at different speeds, causing interference that result in our seeing different colors that shine.
They're generally found on milkweed (as this one was) or on dogbane.