stay away from certain apps. some apps if you are not careful will come with adware which can potentially install other apps and ads onto the phone. read what permissions that app will have before installing them.
this is the only way to prevent such a thing from happening.
you will have to uninstall any recent apps to find out which app it came from. start with the most recent and work your way backwards.
Is this perhaps related to something called "instant apps"? This is a feature Google added a year or two back, and which I'm hoping they'll lose interest in and discontinue same as they do most things (since I saw more risk, or at least potential for annoyance, than benefit in this). Try searching your Settings for any mention of the word "instant" and turn off anything related to that that you can find.
In my s21 there is a toggle "upgrade web links" which allows links to be opened as "instant apps" rather than in a browser. I made sure that was turned off the day I got the phone. It lurks in Settings > Google > Settings for Google apps, but the search function is a quicker way of finding it.
My list of installed apps included something called "instant app engine", a name that would imply that this was the thing that ran instant apps (though it seemed to be one itself, which was strange). I "cleared" (i.e. uninstalled) that when I found it.