The simplest cells, developing about four billion years ago, had no way to control their own movement. They lived in the oceans, and they floated wherever the water took them. Sometimes they found food there, and sometimes they didn’t. Many cells still live this way.
By around 3.5 billion years ago, prokaryote cells began to control their own movements so they could get to where there was food on their own. Inside these cells, proteins formed out of amino acids that were floating in the cytoplasm. When the process went wrong, sometimes the protein accidentally stuck out through the cell membrane into a long hollow tube that stuck out from the end of the cell, or little hair-like arms that stuck out all around the cell. These extra proteins turned out to be useful, because when the cell sent protons over to the end of the flagellum that was still inside the cell, the different electrical charges caused some atoms to be attracted and others to move away, and that forced the flagellum to spin around.
The cell could control the amount of movement by changing how many protons it sent. We call the long tail a flagellum (flah-JELL-um), and the little arms ciliae (SILLY-eye). Some cells have only one flagellum; others have lots of them.
In prokaryote cells, the flagellum moves around and around, like a pinwheel, to push water away from the cell and move the cell forward. Most of the cells on earth still move themselves around this way.
How eukaryote cells move around
Bibliography and further reading about how cells move around: