I don't know about Safari, but if the problem is limited to Chrome you may not have to install antivirus software or do a major reset of your browser.
I had this problem using Chrome, and when I tried to look it up I found there were a lot of sites that had 1) instructions to get rid of it that didn't seem to work for me, and 2) ads at the end for their own antivirus software. It looked like a lot of these sites were just duplicates of each other.
I didn't install any of those, but I did go looking for reputable antivirus programs, and I tried a couple (including ones recommended on this site), but they didn't detect or remove this problem.
Finally I went to my Chrome extensions and unchecked every one of them, and when I restarted Chrome, and the problem was gone. Then I turned each extension back on, one by one, and restarted after each one. I found one extension that, when I checked the box and restarted Chrome, seemed to be the problem, because the ads and virus warnings came back. I deleted that extension, and the problem seems to be gone. After that I was able to turn on all the other extensions and continue as normal.
In this case, the bad extension had a title related to Amazon, but that may not be the case for you -- they will deliberately make their fake extension look like something safe, and they will keep changing the name, so if it happens again, I'll do the same thing and check every extension no matter how safe it looks, till I find the problem.