Biofilms are aggregates of bacterial cells surrounded by an extracellular matrix. Much progress has been made in studying biofilm growth on solid substrates; however, little is known about the biophysical mechanisms underlying biofilm development in three-dimensional confined environments in which the biofilm-dwelling cells must push against and even damage the surrounding environment to proliferate. Here, combining single-cell imaging, mutagenesis, and rheological measurement, we reveal the key morphogenesis steps of Vibrio cholerae biofilms embedded in hydrogels as they grow by four orders of magnitude from their initial size. We show that the morphodynamics and cell ordering in embedded biofilms are fundamentally different from those of biofilms on flat surfaces. Treating embedded biofilms as inclusions growing in an elastic medium, we quantitatively show that the stiffness contrast between the biofilm and its environment determines biofilm morphology and internal architecture, selecting between spherical biofilms with no cell ordering and oblate ellipsoidal biofilms with high cell ordering. When embedded in stiff gels, cells self-organize into a bipolar structure that resembles the molecular ordering in nematic liquid crystal droplets. In vitro biomechanical analysis shows that cell ordering arises from stress transmission across the biofilm-environment interface, mediated by specific matrix components. Our imaging technique and theoretical approach are generalizable to other biofilm-forming species and potentially to biofilms embedded in mucus or host tissues as during infection. Our results open an avenue to understand how confined cell communities grow by means of a compromise between their inherent developmental program and the mechanical constraints imposed by the environment.