Don't use any kind of "anti-virus" or "anti-malware" product on a Mac. There is never a need for it, and relying on it for protection makes you more vulnerable to attack, not less.
This kind of problem is usually not caused by malware. It's a Web scam that only affects the browser, and only temporarily. There are several ways to recover.
1. The easiest thing to do is to force quit the browser. Relaunch it by holding down the shift key and clicking its icon in the Dock, the LaunchPad, or the Applications folder.
You will lose the state of other open tabs and windows. Either Step 2 or Step 3 may enable you to keep that state information. If those steps don't work, fall back to Step 1.
2. Press the key combination command-W to close the tab or window. A huge box will pop up. Press the return key and both the box and the page may close. If that doesn't happen, press and hold command-W. You may hear repeating alert sounds. While holding the keys, click the OK button in the popup. A different popup may appear, which you can cancel out of as usual.
3. From the Safari menu bar, select
Safari ▹ Preferences... ▹ Security
and uncheck the box marked Enable JavaScript.
After closing the malicious page, select from the menu bar
Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data
to get rid of any cookies or other data left by the server. Open the Downloads folder and delete anything you don't recognize.