A flagellum is a lash-like appendage that protrudes from the cell body of  certain prokaryotic and eukaryotic cells. The word flagellum in (latin) means whip. The primary role of the flagellum is locomation but it also often has function as a sensory orangelle, being sensitive to chemicals and temperatures outside the cell.
Flagella are organelles defined by function rather than structure. There are large differences between different types of flagellum; the prokaryotic and eukaryotic flagella differ greatly in protein composition, structure, and mechanism of propulsion, however both are used for swimming.