Anusvar (the dot) doesn’t mean “m” sound. The pronunciation is still “Hindii.”
This change in spellings was brought due to complications with typewriters. Typewriters couldn’t include all 48 characters of Hindi (or something something), so the government decided to skip on those 5 characters from Devanagari when they appear without अ sound, they were-- ण, न, ङ, ञ, म।
If one of these characters appeared with halant, instead of writing them in half, Government decided to use anusvar for them. (Only if these characters preceded another character from their section called varg)
For example, see Ganga:
ग + ङ् + ग + आ
Since ङ and ग belong to the same varg (क ख ग घ ङ), ं will replace ङ, but the pronunciation will remain same. Hence the correct spelling is गंगा, even though the pronunciation is गङ्गा
On the other hand, if the last character from a section is followed by a character from another section, anusvar will not be used.
For example, वाङ्मय, since म and ङ are not from the same section (one from क ख ग घ ङ, another from प फ ब भ म) ं wouldn’t replace ङ, hence वांमय would be incorrect.
Since न and द are from same section (त थ द ध न), anuswar will replace “न” Hence, even though the word is pronounced हिन्दी, correct spelling is हिंदी।
Since this is a rule made for Devanagari, all other languages using this script will also use the same rules (I suppose?)