Whether elliptical galaxies can host life doesn’t matter for us much now, as they are too far away, but if our biological or robotic descendants still exist billions of years from now, they will reside in an elliptical galaxy that will form after the collision of the Milky Way with Andromeda.
In spiral galaxies, stars can have well-defined orbits that keep them at roughly the same distance from the center. This provides a stable environment for the evolution of life, characterized by a lower likelihood of nearby supernova explosions or radiation from high-density stars in the center of galaxies, as well as the emission of radiation from supermassive black holes’ accretion disks or relativistic jets.
In elliptical galaxies stars have radomly oriented radial orbits that can take them for millions of years to the densest parts where there is a high chance of something dramatic to happen, like a nearby supernova explosion or active galactic nucleus when supermassive black holes feed for a while on more matter than usually, releasing a lot of deadly radiation or even relativistic jets that can sterilize planets like powerful lasers.
There are also other types of galaxies besides elliptical and spiral. Irregular ones typically retain this shape for a while after colliding with another galaxy, and living plants could survive with some luck until the situation in the galaxy stabilizes. Some satellite galaxies assume this shape due to the tidal effects of the massive host galaxy and nearby other satellite galaxies. Such irregular galaxies can only make a few orbits before they are absorbed, though, and the survival of life on planets then depends on where they end up in the galaxy after their system is absorbed.
Dwarf non-spiral galaxies can be too small to have safe areas where life could emerge uninterrupted without nearby supernova explosions. A supernova that detonates anywhere in a tiny galaxy can affect a large part of the galaxy.
All of this suggests that spiral galaxies, like the Milky Way, are thought to be more likely to host life and technological civilizations than other types of galaxies.
The question was: Why can life only arise in spiral galaxies? I have heard this said but never explained.