A canonical tag is a line in a page's code that tells Google which address is the real one when the same content can be reached at more than one URL.
A canonical tag tells Google which address is the real one when the same
content can be reached at more than one URL, for example with and without
www, or with tracking parameters on the end. It is one line in the page's
head:
<link rel="canonical" href="https://example.com/learn/seo-basics" />
Google groups duplicate pages and shows one of them. The canonical tag tells it which, and it gathers the signals for the copies, such as the links pointing at them, onto that one address. Google calls it "a strong signal", not an order, so your redirects, sitemap and internal links should point at the same address.
A canonical that names a redirect, a broken page, or a page that names another page makes Google show something other than the page you meant. See indexing and how Google finds and ranks a page.