I am mystified by the puzzlement people have shown over what the CPC's motivation could possibly be. The Xi Jinping administration has been engaged in a ham-handed crackdown on civil society and anyone who engages in political activism or discussion outside the context of the CPC for several years now and that crackdown has recently intensified. VPNs have been disabled, universities have been warned not use Western textbooks or discuss Western ideas, activists and intellectuals have been detained en masse or prevented from returning to the country, etc.
DDoSing foreign websites that are actively attempting to undermine the CPC's censorship and repression campaign is completely in line with the priorities of the CPC's high officials, as well as their general level of subtlety.