Nothing has to be wrong the class for them to devolop a new one. Starfleet came up with more advanced technology thus they created a design of starship to mount said technology on.
Nothing was wrong with the Galaxy class starships. Galaxy class ships doubled as exploration vessels along with large capital ships. They were both heavily armed. Galaxy class starships were constructed in a time of peace and several had schools and other facilities, along with civilian passengers and families of officers. Sovereign class starships had all of those facilities, but many of them didn't allow families. Sovereign class starships were more modern and had the latest technology. They functioned as a more powerful warships with more powerful phasers and quantum torpedoes and photon torpedoes.
If you are talking about the Enterprise, the only reason that the Enterprise-E was commissioned was to replace the Enterprise-D after it was destroyed over Veridian III by the Duras sisters who modified their torpedoes to piece through the Enterprise's shields based on a shield frequency gained from Geordi's VISOR. The Enterprise-D would still be in use for another decade or two if it wasn't destroyed. There was a Sovereign class starship being constructed in 2371 named the USS Honorius, but it was renamed USS Enterprise-E after the Enterprise-D was destroyed.Nothing has to be wrong the class for them to devolop a new one. Starfleet came up with more advanced technology thus they created a design of starship to mount said technology on.
As far as we can tell, the Sovereign did not replace the Galaxy. It was merely a counterpart.