Try this method.
You will have to do this after starting up in Safe Mode to prevent adware
from interfering with the removal of adware .
1. Shut down the computer.
Press the power button. Immediately after you hear the startup sound,
press and hold the Shift key.
The Shift key should be pressed as soon as possible after startup,
but not before the startup sound.
Release the Shift key when you see the Apple logo on the screen.
Startup will take longer than usual.
Screen flickering is normal in Safe Mode.
Login to your account. Launch Safari.
Enter this address https://www.malwarebytes.org/antimalware/mac/
in the Safari address bar.
Download, Install , open, and run it by clicking “Scan” button to remove adware.
Repeat the scan immediately couple of times
Once done, quit MalwareBytes.
2. Turnoff or uninstall extensions if installed.
Section: Manage extensions: https://support.apple.com/guide/safari/use-safari-extensions-sfri32508/mac
3. Choose a search engine.
Delete all text in the Smart Search field, click the magnifying glass , then choose a search engine from the list.
4. Set your Home Page. https://support.apple.com/guide/safari/set-your-homepage-ibrw1020/mac
5. Restart your Mac.
6. Launch Safari holding the Shift key down.