Solar panels don't contain heavy metals as far as I know.
The most likely explanation is that this is a lie.
[0]: https://en.wikipedia.org/wiki/Cadmium_telluride_photovoltaic... [1]: https://en.wikipedia.org/wiki/Crystalline_silicon
They're not merely similar to a photodiode, but using giant photodiodes as batteries is literally the idea.
There are some versions based on toxic organic chemicals in place of toxic inorganic elements, few and far between, and I guess the technology will eventually move onto engineered nanoparticles later in this century after they've cracked fusion, but that hasn't happened yet.