When a search engine crawls a webpage, it follows all the links on that page to discover new pages to index. By default, search engines assume that all links on a webpage are trustworthy and follow them to the destination page. However, sometimes website owners may not want search engines to follow a particular link, such as if it's a paid link or a user-generated link that may be spammy or low-quality.
Adding the rel="nofollow" attribute to a link tells search engines not to follow that link, and therefore, not to pass any "link juice" or ranking power to the destination page. This can help prevent spammy or low-quality links from affecting a website's overall search engine rankings.