Sometimes, mostly in summer, Safari will start to suspiciously jump from one website to another. For example, on Google, when I click on a link of Wikipedia, it jumps to a weird "tune up my Mac" site. Then after about a minute, it switched back. Is it a virus or a settings problem?
Sounds like you installed some software that came with a PUP that acts like adware. There are many of these that try to install unwanted programs during an install. They know that people just click OK while installing so they bundle them into the installer for another program.
Read here and check out what programs you have installed over the past few weeks or months. Uninstall third party add-ones until it goes away.