Yes, I was going to suggest the same thing, that pet chameleons probably don't care about hiding so they don't expend the effort to change color.
I can't answer your question about how camouflage developed, but it may help if you read the WP article on chromatophores from this point on. As you can see, the process that currently drives color changes is fully understood. As far as how it evolved, well, most or all camouflaging animals do this automatically. You'll notice that towards the end the article says, "To change colour the animal distorts the sacculus form or size by muscular contraction, changing its translucency , reflectivity, or opacity."
The animals doesn't know it's doing this (though perhaps they are smart enough to learn how to control it consciously in the case of cephalopods like octopi, which are very intelligent). But initially, the muscular contraction was no doubt a reflex that developed through trial and error. When something flies near your face, you will instinctively close your eyes, and it's difficult to fight this reflex consciously if you want to keep them open. The reflex developed because it protected the eyes of an ancient ancestor species of ours, and indeed continues to be useful because reflexes can kick in faster than our conscious mind can recognize that something is getting close to our delicate eyes.
Also, I want to note this sentence towards the end: "Chromatophores are also found in membranes of phototrophic bacteria". It notes that the colors are useful in absorbing sunlight for photosynthesis. Many times in evolution, a development can be repurposed for other uses, and this may be a partial answer of where the basic ability of cells to acquire or change color came from.