Many corals harbour symbiotic dinoflagellate algae. The algae live inside coral cells in a specialized membrane compartment known as the symbiosome, which shares the photosynthetically fixed carbon with coral host cells while host cells provide inorganic carbon to the algae for photosynthesis1. This endosymbiosis-which is critical for the maintenance of coral reef ecosystems-is increasingly threatened by environmental stressors that lead to coral bleaching (that is, the disruption of endosymbiosis), which in turn leads to coral death and the degradation of marine ecosystems2. The molecular pathways that orchestrate the recognition, uptake and maintenance of algae in coral cells remain poorly understood. Here we report the chromosome-level genome assembly of a Xenia species of fast-growing soft coral3, and use this species as a model to investigate coral-alga endosymbiosis. Single-cell RNA sequencing identified 16 cell clusters, including gastrodermal cells and cnidocytes, in Xenia sp. We identified the endosymbiotic cell type, which expresses a distinct set of genes that are implicated in the recognition, phagocytosis and/or endocytosis, and maintenance of algae, as well as in the immune modulation of host coral cells. By coupling Xenia sp. regeneration and single-cell RNA sequencing, we observed a dynamic lineage progression of the endosymbiotic cells. The conserved genes associated with endosymbiosis that are reported here may help to reveal common principles by which different corals take up or lose their endosymbionts.