Canonical urls are content that has multiple urls pointing to it, but your website specifies which is the preferred url to it. An example is when you have a url with a www. preceding the domain name and a url without the www. and you set a canonical link element to specify which you want as the default one.
I know. I was just giving an example. Here is a Google's take on this: https://support.google.com/webmasters/answer/139066?hl=en
A canonical URL is the URL that you want visitors to see. Quite often canonical URLs were used to describe the homepage. The typical example used is that most people treat the following URLs as the same. You can read this article to know how to use on website https://www.ltnow.com/rel-canonical-seo/
Canonical URL is an easy way to handle duplicate contents. If you have same page in different URL's you can specify canonical url in code, so Google knows the original page. You can do the same with 301 redirect, but here page will not need to redirect.
use it on a website that has different content that appear on different part of the site that you want to refer to. it is used to guide the search engine