Weighing in at 1042 kilograms and measuring 1021 meters across, galaxies are perhaps the most awe-inspiring objects known to mankind. They are also the only places in an otherwise dark and unforgiving universe where stars and planets are able to form. In the past five to ten years we have made enormous progress in understanding when galaxies came into being and how they changed and evolved over the course of cosmic time. For the first time, we have a rudimentary idea of what our own Milky Way looked like in the distant past, and we can now simulate Milky Way–like galaxies inside powerful computers. As we are starting to understand what happened in our galaxy's past, we are now turning to the question of why it happened. Untangling the complex physical processes that shape galaxies is extremely difficult, and will require continued advances in computers and information from powerful new telescopes coming online in the next decade.