When you click a link, you usually send the refferrer url to the site you go to. Naturally google's search terms are a very easy to parse and a well known url. So when you click a site's link they know that you came from google and that you searched for xyz.
Duck duck go actually redirects you in a way so that the referrer is not known to the site. They all think you came from duckduckgo.com. DDG also keeps no logs. Basically your own activity online cannot be used against you.
Now, privacy aside, I really like DDG for other reasons, like search relevance, continuous scrolling, zero-click info, etc. So its kind of win-win for me.