All links are automatically dofollow. When links are dofollow, it means it passes authority and confidence vote, often called link juice, to the web page that it links to. Now, a link that you got from someone else, called a backlink, is an important ranking factor for search engines. Especially during the early days of SEO.
A nofollow link passes no link juice to the linked page, thus have no help in boosting a web page’s ranking. You see, when some SEOs figure out that links will get their web page to top the search result page, they started abusing it. They do it by dropping links at comment sections, forums, blog posts, basically anywhere that they can. Then all those poor websites are linking to these spammers’ websites and sharing the link juice not out of their own free will. While those spammers take advantage of them and got a ranking boost.