First of all, clear that Safari browser. So any track of malware viruses/malware websites will be deleted. In Safari, click on Safari menu and select Clear History and Website Data. Clear everything.
Then download and install this Malwarebytes AntiMalware application from here --> https://www.malwarebytes.com/antimalware/mac/
Then open Malwarebytes AntiMalware application and run a Scan with it. Delete if it finds anything. It will find and remove all malwares if any.
Also, go to Applications > Utilities folder and open Disk Utility. In Disk Utility, select your hard disk in left column (Macintosh HD), then Repair Permission. After that click Verify Disk and if asked to repair, click Repair Disk. This will fix system files corruption etc
Also reset your PRAM and NVRAM of your Mac and this will speed things a little up.
Shut down your Mac
Restart and immediately hold down Command-Option-P-R keys at the same time
Hold the keys down until the computer restarts and you hear the startup sound for two or three times.
Release the keys and let the Mac boot up.
Please let me know if that didn't work, so we can continue troubleshooting