I had that happen when I clicked on a "follow thru link" when I was reading something. Maybe on FB, or it came along for the ride when I downloaded something from the Play Store just to see if it was something I might want.
In my case, I unloaded all of the apps that I had recently downloaded to no avail.
I ran all of the virus and malware checkers available, again to no avail.
The darn thing installed itself into the system and is bypassing all attempts to get rid of it.
I finally had to bite the bullet, make backups of everything I wanted to save, and do a Factory Reset to virgin territory and rebuild the phone.
It never appeared again after that. In my case, those ads would overlay the screens I was using. Very irritating.