If it's a state actor - the Chinese and Russians do it for practice and to sow general chaos / destruction of US infrastructure, costing money and tying up resources. Sometimes it's just to slow down other country's academics.
If it's not, it's a group doing it for practice, the lulz...and under the encouragement (or at least ambivalence) of the Russian or Chinese.