Why does a rocket spin during launching?
The thrust from the rocket is not quite "straight down", but at an angle - and slightly offset from the center. If the (solid) fuel burns ever-so-slighly unevenly, the surface that the burnt fuel pushes against will be at a slight angle; and since the rocket has relatively small angular momentum about the long axis, it will readily spin.
Note - once the fuel is almost spent, the rotation stops (aided by the fins which try to keep the rocket straight).
If you are trying to aim a rocket, imparting a bit of rotation might be a good idea. Just as the rifling of a gun barrel cause the bullet to spin about its axis, this has two effects: first, if the shape of the rocket/bullet is slightly asymmetrical, the rotation will cause a "self-correction" of the deviation this incurs. You will go up-right-down-left and end up pointing in (roughly) the right direction. Second, the rotation will stabilize the bullet against the torque caused by the drag when the bullet is not pointing straight in the direction of travel. Instead of "tipping on its side" (think about how a playing card falls when you drop it "straight"), the rotation will keep the bullet pointing in the direction of travel.
In summary - it's accidental in this case; but when it is done deliberately, it's a good thing.
In a nutshell, the rotation slows the rocket's reaction to disturbances which might throw it off course.
This is similar to how a spinning gyroscope can remain upright and seems to resist forces which would seem to topple it.