The Online Etymological Dictionary states
His [Castor's] name was given to secretions of the animal (Latin castoreum), used medicinally in ancient times. (Through this association his name replaced the native Latin word for "beaver," which was fiber.)
Castoreum has been used medicinally since Classical times, prominently as an ingredient in material medica and theria — the latter appeared in the Amsterdammer Apotheek as late as 1683, not too long before Linnaeus. Both concoctions had been used by the ancient Greeks and Romans, establishing themselves as supposed cure-alls.
The connection between castoreum and Castor is not as clear. The Online Etymological Dictionary states that Castor was venerated by ancient Greek women as a healer; I have not been able to confirm this in any writings. This page does state that no great explanation has been put forth in this regard, only that there is speculation that Castor (Kastor, if you prefer an alternate spelling) was transformed into a beaver and back in the course of some myth. Again, I have found no evidence of this. The direct mythological aspect here seems to be a dead end.
The second part of your question is more interesting. The ancient Greeks and Romans were well aware of castoreum and used it for a variety of medicinal and health uses. Plutarch, for example, refers to it several times in his Moralia (version in English). And yes, castor was one word used by the Romans to refer to beavers (see the Lewis Elementary Latin dictionary), leading directly to the modern taxonomic usage, including that of Linnaeus in Systema Naturae. Linnaeus's usage, interestingly enough, was originally towards the same species of beaver that the Romans would have been familiar with — the Eurasian beaver, Castor fiber.
The naming of the stars Castor (actually a triple star system) and Pollux seems to be somewhat unrelated to the specifics of the Greek/Roman myths of Castor and Pollux. Rather, the names may have been applied the Alpha Geminorum and Beta Geminorum due to the Babylonian naming of the two stars as "The Great Twins" (see Rogers (1998)). The idea that the two stars were twins was then passed on to the Greeks, and then the Romans, and thus they used their example of the divine twins.
The stars are not, however, related to beavers.