The adware program may have been bundled with other software you installed on the computer, like a “free” tool bar extension or game.
These types of invasive programs - which can affect Macs along with PCs - often redirect your browser to certain pages so those sites can get revenue by showing advertisements to (unwilling) visitors. If you are experiencing constant pop-up ads, trips to websites you didn’t intend to visit, a frequently changing home page, ads trying to sell you obscure security software or other odd browser behavior, your computer is probably infected with an aggressive adware program. I keep getting pop-ups in my browser search bar and sent to a site I’ve never heard of.