A crucial step in several major evolutionary transitions is the division of labor between components of the emerging higher-level evolutionary unit. Examples include the separation of germ and soma in simple multicellular organisms, appearance of multiple cell types and organs in more complex organisms, and emergence of casts in eusocial insects. How the division of labor was achieved in the face of selfishness of lower-level units is controversial. I present a simple mathematical model describing the evolutionary emergence of the division of labor via developmental plasticity starting with a colony of undifferentiated cells and ending with completely differentiated multicellular organisms. I explore how the plausibility and the dynamics of the division of labor depend on its fitness advantage, mutation rate, costs of developmental plasticity, and the colony size. The model shows that the transition to differentiated multicellularity, which has happened many times in the history of life, can be achieved relatively easily. My approach is expandable in a number of directions including the emergence of multiple cell types, complex organs, or casts of eusocial insects.