A canonical URL (and the content there) is your preferred version. Let’s say you had duplicate content on 2 URL’s. While both URL’s are valid, you’d like search engines to rank your preferred version. So, on the version that is NOT preferred, you specify the canonical URL – the URL of your preferred version. Consider this practical example. Some believe that pages hold rank better than posts. You write a blog post that becomes extremely popular, and you later decide that to preserve that popularity, you’d like to put the blog post content on a page. That would be duplicate content. The canonical URL tag allows you to mark up the blog post and inform search engines that your preferred version (the canonical version) is the page URL. That way, you can transfer the rank you built on the blog post to the page.
For the 301 redirect, that is a way to redirect an old URL to a new one. Once you make a blog post that is indexed by a search engine, deleting the blog post does not delete the URL from the search engine index. Following on the canonical URL example, let’s say you created a blog post but later moved the content to a page with a different URL. The canonical tag tells search engines which URL is preferred, but both URL’s remain in the search engine’s index. The 301 redirect is an additional tool to automatically direct visitors to the page – your preferred version. Over time, the 301 redirect will cause a search engine to update its index and remove the URL that you don’t want people to visit.