China was a big solar exporter before it was a big solar installer. China had a small solar manufacturing capacity in 2003. By 2008 it was number one in the world for solar manufacturing and it has remained there since:
Before that, solar power was too expensive for large scale use inside China. Chinese renewable energy growth was mostly hydropower and wind before 2013. Now of course China is by far #1 in yearly solar power installations as well as solar manufacturing, and that in combination with electric vehicle adoption is helping to curb oil demand:
"China’s electric car revolution hammers demand for oil"
China primarily wants to cut oil and gas imports. Exports are a bonus.