The evolution of different cell types was a key process of early animal evolution1–3. Two fundamental cell types, epithelial cells and amoeboid cells, are broadly distributed across the animal tree of life4,5 but their origin and early evolution are unclear. Epithelial cells are polarized, have a fixed shape and often bear an apical cilium and microvilli. These features are shared with choanoflagellates – the closest living relatives of animals – and are thought to have been inherited from their last common ancestor with animals1,6,7. The deformable amoeboid cells of animals, on the other hand, seem strikingly different from choanoflagellates and instead evoke more distantly related eukaryotes, such as diverse amoebae – but it has been unclear whether that similarity reflects common ancestry or convergence8. Here, we show that choanoflagellates subjected to spatial confinement differentiate into an amoeboid phenotype by retracting their flagella and microvilli, generating blebs, and activating myosin-based motility. Choanoflagellate cell crawling is polarized by geometrical features of the substrate and allows escape from confined microenvironments. The confinement-induced amoeboid switch is conserved across diverse choanoflagellate species and greatly expands the known phenotypic repertoire of choanoflagellates. The broad phylogenetic distribution of the amoeboid cell phenotype across animals9–14 and choanoflagellates, as well as the conserved role of myosin, suggests that myosin-mediated amoeboid motility was present in the life history of their last common ancestor. Thus, the duality between animal epithelial and crawling cells might have evolved from a temporal phenotypic switch between flagellate and amoeboid forms in their single-celled ancestors3,15,16.