Understanding it
Duplicates appear without anyone creating them: tracking parameters, URLs with and without a trailing slash, shop filters, printable pages. Without guidance, Google picks the version to show on its own and splits signals across copies.
Google lists the methods by strength: redirects, then the canonical tag, then inclusion in the sitemap. They work best together, and must say the same thing.
A canonical tag does not remove a page from the index or block crawling: it says which version to put forward.
A concrete example
Illustrative example: a shop and its filters
An online shop generates one address per filter combination: colour, size, price sort. Google finds hundreds of them, almost identical to the category page.
Each variant now points to the category with a canonical tag, and the sitemap only lists categories. Signals gather on one page instead of being spread thin.
The common mistake
Pointing every page to the homepage
A canonical tag copied into the template that sends every page to the homepage asks Google to ignore the rest of the site. Each page should point to itself, unless it really is a duplicate of another.