It is due to the fact that digital cameras, like those smartphones have, do not capture the whole image in a single instant. Instead, they scan from one corner to the opposite one.
Scanning obviously takes place in a very short period of time, but if something in the frame moves at a faster pace than the scan, the camera picks it up at different times, and brings them all back together in the photo.
Below, some examples: