When you comment on a blog, you enter your URL. Now the blog you commented on has a link back to your website. Google judges a website's popularity by the number of websites linking back to it.
This is a generalization, and there are other factors, but basically -The more websites that link to you= more street cred = better Search Engine Ranking.