No, there's no particular logic to it, it's just the rules that Brendan Eich decided on during those fraught ten days in May 1995. The full rules are here. Eich just decided that allowing
$ in identifier names would be handy. He also allowed
_ (which is more common in programming languages), as well as the usual set of English letters and numbers (where numbers can't appear in the first character).
Ultimately, a wide range of Unicode characters were allowed (for instance, fairly famously,