The pulley surface is not frictionless so that the string does not slide on the pulley.
You can adjust m2 and press play to see how the pulley rotate due to unequal tension on the strings at two side of the pulley.
Virtual Physics laboratory Original URL
Fu-Kwun Hwang, Dept. Of Physics, National Taiwan Normal University.