It is an indication to search engines, to advise them to present the canonical version in their search result pages, and not the non-primary, alternate version.
Search engines can ignore canonical tags
Precisely because a canonical tag is "just" an indication (a hint) and not a directive (an instruction that has to be followed, such as those found in a website's robots.txt), search engines can ignored it.
Why would they? First of all, because sometimes, canonical tags are implemented the wrong way. Then, search engines can find out that signals sent by canonical tags are inconsistent with other, more trustworthy signals.
Or, the canonical information is outweighed by other considerations.
Whatever the reasons, if you are focusing your SEO work on canonical pages while, and if in the mean time, search engines are preferring some non-canonical pages, you are wasting time and are not achieving results.