As a theoretical astrophysicist, I have studied the formation and evolution of galaxies and the nature of the matter lying between galaxies known as the intergalactic medium (IGM). In particular, using numerical simulations, I demonstrated that the pattern of absorption features in the spectra of distant quasars known as the Lyman-alpha forest is produced by diffuse gas in the IGM lying in filamentary structures sometimes referred to as the Cosmic Web. These results show that the Lyman-alpha forest maps onto density fluctuations along sightlines to quasars, making it possible to measure the growth of cosmic structure with time, providing tests for theories of the matter evolution of the Universe, and enabling measurements of basic cosmological parameters. By employing simulations on smaller scales, I have shown that collisions between gas-rich galaxies drive inflows of gas into the centers of merger remnants. These dense, massive concentrations of gas fuel episodes of rapid star formation (starbursts), explaining the nature of peculiar, infrared-luminous galaxies and providing the raw material to grow supermassive black holes in galaxy centers. The energy produced by the growth of these black holes can account for the luminosities and lifetimes of quasars, the most energetic sources in the Universe. Moreover, the relics of this process, central collections of stars and inactive black holes, explain the structure and properties of elliptical galaxies, demonstrating that galaxy mergers are a key ingredient in shaping galaxies. More recently, I have been involved in large collaborations to use cosmological simulations to study galaxy formation and evolution. These projects, known as Illustris and IllustrisTNG, include the known constituents of the Universe and make it possible to predict the structure of galaxies starting from initial conditions provided by observations of the cosmic microwave background and Type 1a supernovae.