Ok, firstly, saying he may have been a mortal is wrong, he was a mortal, we know he died.
And we know he was a man, Tolkien names him exactly that in the letter, and rather than talking about any natural power, something Bombadil-like, he refers to Beorn as a magician.
So the whole story of Gandalf about Beorn descending from the great bears of the mountains is more or less a way to explain his origins to the Hobbits, but not something we should take seriously.
About his origins, we know for sure that Beorn had lived in the Misty Mountais before he was forced to move away by the coming of the Orcs, so he had lived there previously. But as far as we know, he was not created by the Valar or anything else, he was born by a woman.
It is said in HoMe 12 that the Beornings were related to the Woodmen, the Bardings of Dale and the Eotheod, meaning that Beorn descended from a group of people existing prior to the events of the Hobbit, the men of the mountains who were forced to leave by the coming of the Orcs and other creatures.
So much to his origins. Now to the origin of his power. Here, I have two theories, the latter of which I rather prefer.
Theory 1: some time in the development of the men of the mountains they learned how to transform into bears. How? No idea. Some old, shamanical rituals, maybe learned from Orome in times long forgotten or from some Maia that was never mentioned. This I rather doubt since Gandalf would probably know if some Maia had had anything to do with it, so maybe these men learned it on their own. After all in Tolkien's works people with a special, strong connection to nature like Beorn anyway always seem to have special powers, so why not believe that these otherwise rather primitive men found out a way to shapeshift.
Theory 2: this which I rather prefer is that Beorn learned it, as the first one to have ever learned it, from Radagast the Brown. We know he knew Radagast, that they were friends, especially because of their common passion of being in nature, and that they met at times. We also know that Radagast was a master of shapes and hues. Not directly called shapeshifter, but a hint to it is there. So why wouldn't the master of shapes and hues teach his friend a trick or to so that Beorn can defend himself and the Woodmen of the region as well? It makes perfect sense that Beorn was taught this technique and that because of his innate love for beasts he mastered it fairly quickly. His descendants would then perhaps also at a certain age learn this trick.
Btw, nice thread, Beorn is one of my favourite topics, I like the unknown, mysterious creatures of M-e.
