Why did China not support Russia during the Soviet invasion of Afghanistan?
The major reason for this is that China was much more concerned with its relations with Afghanistan and Pakistan than with the Soviet Union. It is also important to remember that China and the Soviet Union had not been close allies for years by this time.
To China, relations with Pakistan and Afghanistan are fairly important. The Chinese want to have a buffer zone of friendly countries between themselves and India since India is an important rival of theirs. In addition, the Chinese have a large Muslim population in their country (particularly in the western areas) and they do not want to anger that population when they can avoid it.
So, China's strategic interest in Afghanistan and Pakistan (which also supported the Mujahideen) and their rivalry with the Soviet Union combined to make China oppose the Soviet invasion of Afghanistan.