In cosmology, the study of galaxy formation and evolution is concerned with the processes that formed a heterogeneous universe from a homogeneous beginning, the formation of the first galaxies, the way galaxies change over time, and the processes that have generated the variety of structures observed in nearby galaxies. Galaxy formation is hypothesized to occur from structure formation theories, as a result of tiny quantum fluctuations in the aftermath of the Big Bang. The simplest model in general agreement with observed phenomena is the Lambda-CDM model—that is, clustering and merging allows galaxies to accumulate mass, determining both their shape and structure. Hydrodynamics simulation, which simulates both baryons and dark matter, is widely used to study galaxy formation and evolution.

Commonly observed properties of galaxies Because of the inability to conduct experiments in outer space, the only way to “test” theories and models of galaxy evolution is to compare them with observations. Explanations for how galaxies formed and evolved must be able to predict the observed properties and types of galaxies.

The galaxy classification scheme commonly known as the Tuning-Fork diagram has roots in work by James Jeans and John Henry Reynolds. Jeans (1919) and Reynolds (1920) established the E–S0–S morphological sequence. Edwin Hubble (1926) subsequently popularised and extended this framework, bifurcating the spiral branch to distinguish barred from unbarred spirals. Jeans (1928) then produced the Y-shaped diagram that encapsulated this sequence in visual form, later turned sideways to become the tuning fork.. It partitioned galaxies into ellipticals, lenticulars, normal spirals, barred spirals (such as the Milky Way), and irregulars.

While the Tuning Fork remains a widely used descriptive tool, it does not encode evolutionary pathways between galaxy types — it is a morphological classification, not an evolutionary schema. A more recent framework called the Triangal, introduced by Alister W. Graham, explicitly maps evolutionary channels between galaxy species. Unlike the Tuning Fork, the Triangal distinguishes three physically distinct origins for lenticular (S0) galaxies: (i) primeval systems that have never been through a major merger; (ii) faded spiral galaxies that have exhausted their gas supply; and (iii) dust-rich S0 galaxies assembled through wet (gas-rich) major mergers, constituting a "green mountain" population. The framework further identifies a 'Disc Down-sizing' sequence in which successive dry (gas-poor) mergers progressively erase stellar discs, transitioning galaxies from ES (ellicular) types through to pure ellipticals with depleted cores. By treating galaxy morphology as a record of accretion and merger history rather than a static label, the Triangal provides a physically motivated reference frame for interpreting galaxy scaling relations and black hole–galaxy coevolution.

These galaxy types exhibit the following properties which can be explained by current galaxy evolution theories:

Many of the properties of galaxies (including the galaxy color–magnitude diagram) indicate that there are fundamentally two types of galaxies. These groups divide into blue star-forming galaxies that are more like spiral types, and red non-star forming galaxies that are more like elliptical galaxies. Spiral galaxies are quite thin, dense, and rotate relatively fast, while the stars in elliptical galaxies have randomly oriented orbits. The majority of giant galaxies contain a supermassive black hole in their centers, ranging in mass from millions to billions of times the mass of the Sun. The black hole mass is tied to the host galaxy bulge or spheroid mass. It is now recognized that the black hole mass scaling relation is specific to the galaxy's morphology, which serves as a signature of the galaxy's distinct formation and assembly history. Furthermore, in fainter, lower-mass galaxies, a central nuclear star cluster frequently co-exists with the supermassive black hole, and a mathematical mass scaling relation exists between these two central massive objects. Metallicity has a positive correlation with the luminosity of a galaxy and an even stronger correlation with galaxy mass. Astronomers now believe that disk galaxies likely formed first, then evolved into elliptical galaxies through galaxy mergers.

Current models also predict that the majority of mass in galaxies is made up of dark matter, a substance which is not directly observable, and might not interact through any means except gravity. This observation arises because galaxies could not have formed as they have, or rotate as they are seen to, unless they contain far more mass than can be directly observed.

Formation of disk galaxies The earliest stage in the evolution of galaxies is their formation. When a galaxy forms, it has a disk shape and is called a spiral galaxy due to spiral-like "arm" structures located on the disk. There are different theories on how these disk-like distributions of stars develop from a cloud of matter: however, at present, none of them exactly predicts the results of observation.

Top-down theories Olin J. Eggen, Donald Lynden-Bell, and Allan Sandage in 1962, proposed a theory that disk galaxies form through a monolithic collapse of a large gas cloud. The distribution of matter in the early universe was in clumps that consisted mostly of dark matter. These clumps interacted gravitationally, putting tidal torques on each other that acted to give them some angular momentum. As the baryonic matter cooled, it dissipated some energy and contracted toward the center. With angular momentum conserved, the matter near the center speeds up its rotation. Then, like a spinning ball of pizza dough, the matter forms into a tight disk. Once the disk cools, the gas is not gravitationally stable, so it cannot remain a singular homogeneous cloud. It breaks, and these smaller clouds of gas form stars. Since the dark matter does not dissipate as it only interacts gravitationally, it remains distributed outside the disk in what is known as the dark halo. Observations show that there are stars located outside the disk, which does not quite fit the "pizza dough" model. It was first proposed by Leonard Searle and Robert Zinn that galaxies form by the coalescence of smaller progenitors. Known as a top-down formation scenario, this theory is quite simple yet no longer widely accepted.

Bottom-up theory More recent theories include the clustering of dark matter halos in the bottom-up process. Instead of large gas clouds collapsing to form a galaxy in which the gas breaks up into smaller clouds, it is proposed that matter started out in these “smaller” clumps (mass on the order of globular clusters), and then many of these clumps merged to form galaxies, which then were drawn by gravitation to form galaxy clusters. This still results in disk-like distributions of baryonic matter with dark matter forming the halo for all the same reasons as in the top-down theory. Models using this sort of process predict more small galaxies than large ones, which matches observations.

Astronomers do not currently know what process stops the contraction. In fact, theories of disk galaxy formation are not successful at producing the rotation speed and size of disk galaxies. It has been suggested that the radiation from bright newly formed stars, or from an active galactic nucleus can slow the contraction of a forming disk. It has also been suggested that the dark matter halo can pull the galaxy, thus stopping disk contraction.

The Lambda-CDM model is a cosmological model that explains the formation of the universe after the Big Bang. It is a relatively simple model that predicts many properties observed in the universe, including the relative frequency of different galaxy types; however, it underestimates the number of thin disk galaxies in the universe. The reason is that these galaxy formation models predict a large number of mergers. If disk galaxies merge with another galaxy of comparable mass (at least 15 percent of its mass) the merger will likely destroy, or at a minimum greatly disrupt the disk, and the resulting galaxy is not expected to be a disk galaxy (see next section). While this remains an unsolved problem for astronomers, it does not necessarily mean that the Lambda-CDM model is completely wrong, but rather that it requires further refinement to accurately reproduce the population of galaxies in the universe.

Galaxy mergers and the formation of elliptical galaxies

Elliptical galaxies (most notably supergiant ellipticals, such as ESO 306-17) are among some of the largest known thus far. Their stars are on orbits that are randomly oriented within the galaxy (i.e. they are not rotating like disk galaxies). A distinguishing feature of elliptical galaxies is that the velocity of the stars does not necessarily contribute to flattening of the galaxy, such as in spiral galaxies. Elliptical galaxies have central supermassive black holes, and the masses of these black holes correlate with the galaxy's mass.

Elliptical galaxies have two main stages of evolution. The first is due to the supermassive black hole growing by accreting cooling gas. The second stage is marked by the black hole stabilizing by suppressing gas cooling, thus leaving the elliptical galaxy in a stable state. The mass of the black hole is also correlated to a property called sigma which is the dispersion of the velocities of stars in their orbits. This relationship, known as the M-sigma relation, was published in 2000. Recent studies show that this relation only holds over a limited range, steepening at high black hole masses—a behavior explained by the Virial theorem—which reflects the distinct merger history of the most massive elliptical galaxies. Elliptical galaxies mostly lack disks, although some bulges of disk galaxies resemble elliptical galaxies. Elliptical galaxies are more likely found in crowded regions of the universe (such as galaxy clusters).

Astronomers now see elliptical galaxies as some of the most evolved systems in the universe. It is widely accepted that the main driving force for the evolution of elliptical galaxies is mergers of smaller galaxies. Many galaxies in the universe are gravitationally bound to other galaxies, which means that they will never escape their mutual pull. If those colliding galaxies are of similar size, the resultant galaxy will appear similar to neither of the progenitors, but will instead be elliptical. There are many types of galaxy mergers, which do not necessarily result in elliptical galaxies, but result in a structural change. For example, a minor merger event is thought to be occurring between the Milky Way and the Magellanic Clouds.

Mergers between such large galaxies are regarded as violent, and the frictional interaction of the gas between the two galaxies can cause gravitational shock waves, which are capable of forming new stars in the new elliptical galaxy. By sequencing several images of different galactic collisions, one can observe the timeline of two spiral galaxies merging into a single elliptical galaxy.

In the Local Group, the Milky Way and the Andromeda Galaxy are gravitationally bound, and currently approaching each other at high speed. Simulations show that the Milky Way and Andromeda are on a collision course, and are expected to collide in less than five billion years. During this collision, it is expected that the Sun and the rest of the Solar System will be ejected from its current path around the Milky Way. The remnant could be a giant elliptical galaxy.

Galaxy quenching