Progress in epitaxial growth of complex oxides have led to heterostructures with a unique set of physical phenomena, such as the formation of a high-density two-dimensional electron gas (2DEG) at the interface between two normally insulating materials—e.g. SrTiO3/LaAlO3 and SrTiO3/GdTiO3. Superconductivity and magnetic ordering have been demonstrated in these systems, sparking the interest in novel device applications. The formation of a 2DEG at the interface between SrTiO3 and Mott insulators, such as GdTiO3, have also been demonstrated, with electron densities that are over an order of magnitude higher than those realized with conventional semiconductors. Charge transport in these systems exhibit exquisite behavior, varying drastically from metal to insulator depending on the thickness of the building-block layers. Despite the intense research efforts in the last decade, the origin of the excess charge and the mechanisms that determine the density of the 2DEG are still under debate, and fundamental properties of the 2DEG are not fully understood. In this presentation, we will discuss how computer simulations can provide insights into the origin and nature of the 2DEG. Based on results of first-principles calculations we will discuss electron correlation effects and how the electronic structure of these heterostructures can be drastically altered, turning from metallic into insulating, through charge localization in ultrathin layers. Charge localization will also be addressed in the context of small polaron formation, and these concepts will be used to explain transport and optical phenomena observed in the bulk materials.