Galaxies form from the gravitational collapse of matter in the early universe, resulting in collections of stars, gas, and dark matter. Over time, they evolve through interactions, mergers, and the ongoing formation of stars. These processes influence their structure, leading to diverse shapes such as spirals and ellipticals. Observations of distant galaxies at different stages help us understand this evolution.