When importing a TCX file from Polar into Garmin, you get the error "Er is een fout opgetreden bij het uploaden. Probeer het opnieuw." which means as much as "An unexpected error occurred while uploading. Please try again."

If you upload your Polar TCX file here, it will add those two tags and offer you the fixed files in a .zip file download that should work with Garmin.

Select files:
The technical details includes the error "An unexpected error occurred while processing the file." (500 internal server error)

Comparing the Garmin and Polar TCX exports, I noticed that the Polar file misses a "BuildMajor" and "BuildMinor" tag near the bottom (in TrainingCenterDatabase - Author - Build - Version).

In contrast to others (looking at you, tcxtools.com), the source code is publicly accessible here. The zipstream.php include you see is from my 2016 Factorio project.