This is still a somewhat contentious question among theorists, but essentially the density waves that create the spiral pattern in spiral galaxies are only stable in the outer parts of a galaxy, beyond a certain radius called in “inner Lindblad resonance”. In the inner parts of the galaxy, different mechanics operate.
Simulations suggest that in these inner parts, density waves still occur, but they tend to cause material to pile up into a linear feature (i.e. a bar) rather than a spiral pattern. However, the timescale for the bar to appear is quite long, and so young spiral galaxies may not have had time to grow a bar yet, even if their spiral structure is well developed. They may well start acquiring a bar in the future.
Moreover, when spiral galaxies collide with one another, or have close gravitational encounters, this tends to mess up the delicate spiral structure and bar formation processes and cause them to ultimately become elliptical galaxies.
Edwin Hubble believed that elliptical galaxies turned into spiral galaxies over time, but we now believe that the opposite is true.