You haven't given the group much information to go on. Let's try to gather more.
Where was this gallery that had photos that disappeared and were replaced with pictures from your old phone?
Was it on a new phone, on an iPad, on a Mac, on a Windows PC, or somewhere else?
For the moment, let's assume it was on a new phone, since you mentioned an old phone.
Pictures could come from an old phone to a new one in various ways, but each would have a triggering event.
Normally, when you replace your phone, you would migrate the contents of the old phone to the new one, including the photos, but the new phone would be empty when you start the migration, so that doesn't match your situation.
If your old phone had been joined to iCloud Photos, its photos would be in iCloud. If you did not migrate them and the connection to the new phone, then later joined the new phone to iCloud Photos, the new phone would merge its holdings into iCloud Photos. That also doesn't match your situation.
There is an exception to that last point. If the new phone had photos cable-synced from a Mac or PC, they are held in a special area not really managed as part of the Photos library and not compatible with iCloud Photos. Enabling iCloud Photos on such a phone removes cable-synced photos (and videos) after giving a warning. That does match your situation, except that you would have taken the action of enabling iCloud Photos.
If that is the explanation for your situation, you should look for those photos on the Mac or PC from which you cable-synced them to the new phone before their loss.