Suspected adware infection of Mac
Solution 1:
If you suspect your Mac may have malware or adware installed on it, I would recommend trying BitDefender, a lightweight antivirus app for Mac (available for free on the Mac App Store), which I have found to be especially good at detecting both adware and malware and then removing it. BitDefender scans your machine when prompted (good for an ongoing issue) but does nothing in the background.
If you want constant protection in the future (that promises to block malware from being downloaded onto your Mac in the first place, and has fulfilled its promise twice for me) you can try Avast, which is also free (but not available from the Mac App Store, just their website).
Hope this helps, let me know if your problem reappears in the future.