Canonical is a piece of HTML code marked with rel=”canonical”.
This tag defines a major version of a page with the same or similar content.
For example, if you have the same or similar content under different URLs, you can use the canonical to tell the search engine which version is the main version, and which, therefore, should be indexed.

But the canonical tag is auxiliary to the crawler, and even if you have two identical pages with or without a canonical, there is a chance that the page will be indexed without the canonical tag.