Essentially, China is filling the void left by the fall of the Soviet Union—the USSR up until 1991 did a lot of trade with a number of African countries.
And African leaders encourage it, because China builds infrastructure and buys raw materials without demanding adoption of environmental regulations or legalization of homosexuality as Western nations do.