I will go further and suggest you BUY MalwareBytes so that it prevents this from happening in the first place, and when it asks if you want the free Browser Guard put in, say yes. A year license is around $55 for up to three devices (any mix of Mac, Windows, or Android devices — the iPhone/iPad don’t need it). You can buy it directly from the company, but London Drugs often has it on sale for around $40.
If you only have a single device and would like to buy just a single license, go see Gary Beyer at Tesseract Computers, or call Alan Perry. Either one can sell you a single-machine license for even less.
Secondly, if you’re running any other “anti-virus” for the Mac, just uninstall that. They’re all garbage except (maybe) Eset (haven’t tested it enough yet) and the aforementioned MalwareBytes. McAfee, Kaspersky, Avast, and particularly Norton … just expensive garbage at this point, though all were probably fine a decade or more ago.
My other suggestion is to be very sure you are going to the site you think you are going to. A slight misspelling in the address bar or a bookmark, and you will often find yourself on a fraudulent copy of the site you were trying to visit. My favourite example:
whitehouse.gov = the legit website of the US president, run by the federal government.
whitehouse.com = a porn site.