I don't believe it's from Chile, nor a mining token, but you're not too far off on both cases. I believe it's a commemorative coin-like medal, known as a "proclamation coin". These were struck to "proclaim" certain events, and often circulated as semi-official coinage.
The side you've labelled "obverse" reads "To the defender of national independence" and the date "1841". It doesn't say who died, or which nation, and the flag is too unclear to make out which country it might be.
The "reverse" says "Gratitude of the Department of Potosi". This is helpful; Potosi Department is a province of southern Bolivia on the Chilean and Argentine border and the location of the once-vast Potosi silver mine. There is also a date, "18th November" - which is presumably linked to the year on the other side.
At first I thought that meant we needed to find a war hero or some such, from Bolivia, who died on November 18, 1841. A bit of searching turned up
Agustin Gamarra, Peruvian President and General, who was killed in the Battle of Ingaví on that date, while trying to invade Bolivia. When he died, the Peruvians withdrew.
Now this was a bit of a red herring, as Gamarra was Bolivia's enemy, so this coin can't be commemorating him as a slain war hero - quite the opposite. This must be celebrating the death of a hated enemy and proclaiming victory against the forces of a hostile invader.
There are reference books on these "proclamation coins". I don't have one. Because they're not "official coinage", they're not normally included in Krause. At 19mm, this one would have been equivalent to the Bolivian silver sol.