Welcome to Android Central! That was a browser popup ad designed to scare you into thinking you have a virus. It's not from Google -- it's related to the site you were visiting. If you installed the app that the popup recommended from the Play Store, then you're probably ok, since the Play Store is generally very good about keeping actual malware out. It probably had adware instead. Uninstalling it probably got rid of all of it.
In the future, never tap anything in those popups. My usual advice about avoiding malware:
1. Avoid shady websites that deal with things like porn, gambling, and "free" (aka pirated) apps/music/movies.
2. Never ever tap on a link that appears in a popup while browsing, especially if they're warning you that your phone is infected -- they're just trying to scare you into installing some bogus "antivirus" app that is probably malicious itself.
3. Only install apps from well-established app sources like Google Play Store or Amazon Appstore. Read a bunch of app reviews before installing an app to look for any complaints about adware or suspected malware.
4. Turn on Google Play Protect features in Settings>Google>Security. This allows Google to periodically scan your phone's apps to look for malware.
5. Turn off "Unknown Sources" in Settings>Security. This prevents any app that wasn't obtained from Google Play Store from being installed (which could include malicious apps that are inadvertently downloaded).