There are recurring patterns in how magic is handled in fantastic tales; magic (assuming it is handled consistently) can only enter into a tale if it is emblematic of, or correlative to, something else. Depending on whether the magic in question is something out of human hands or under human control, magic will serve as emblem or correlate either of a numinal/religious order, a providence, so to speak, or of specialized skill. However it is conceived as to details, magic has to be either something in the order of things or something people are capable of doing. The latter is perhaps the more common. Magic as usually conceived in a story or narrative is a subjective causation of marvelous objective effects; and the subjective causation of objective effects that is best known in our natural, ordinary, everyday experience is technical skill. Some specialized skills, in fact, seem at their best to border on this, anyway. Lots of the different 'flavors' of fantasy arise from the particular kind of skill that is used as the correlate. Thus Tolkien's Elves and Dwarves do magic; their magic is in general an idealized artistry. (Tolkien is quite explicit about this, but it could have been inferred anyway from the kind of things they can do.) This is very different from the kind of magic represented in, say, The Dresden Files, which is correlative not to art but to skills related to forensic investigation. In principle, any technical skill that already seems, at its height, to border on the marvelous or amazing can easily serve as a model for a kind of magic, and any context for such a skill can easily be 'fantasticized'. Metalwork, dancing, singing, hunting, reading and writing, computer programming, have all at some point or other been treated in this way.
The reverse is true, as well, though; it's not just a matter of human storytelling. Just as we build tales of magic or fantastic deeds on the model of real skills and crafts, so, too, we talk about real skills and crafts in magical terms. This has always been the case and will certainly always be the case.
This latter point can complicate our understanding of history. People's assumptions about the way alchemy or astrology was practiced, for instance, are a mish-mash of different elements. Some of the things people assume were obviously true about medieval or Renaissance alchemy were outright inventions, mere literary tropes that arose because they sounded good in a particular context, and that continued to be used because they made for striking effects in stories. Others have a connection to real alchemical practice, but may be filtered through various literary and artistic symbolisms. Yet others may have their first origin in outright fabrication and counterfeit, as if advertisements and frauds about 'fractal water' or 'health through quantum effects' were, three hundred years from now, taken as obviously the sort of thing twentieth century physicists were normally trying to do. You can imagine people half a millenium from now just taking it as obvious that forensic investigation in our day had such-and-such features that were in fact pieces variously derived from police reports, news outlets including the tabloids, Basil Rathbone movies, CSI, Nero Wolfe, and The Dresden Files. It would obviously have a connection of some sort to real criminal investigation, but it will have been filtered through any number of other outlets. This is pretty much what most people's view of alchemy is: a mish-mash thrown together from various fragments of genuine alchemical practice, literary use of alchemy as a symbol, and confidence games involving alchemical terminology, treated as if it were an accurate rendering of what alchemists did or attempted to do.
When this happens on a major scale, historical investigation becomes very difficult; it requires a very careful regard for which kind of alchemy, which image of alchemy, and which use of alchemical ideas and terminology are relevant at a given time. The actual skills and crafts used by most alchemists may have no natural connection with later images of them, and when they do, it may not be straightforward. The lives of alchemists in general were less involved in attempting 'magical' things than we often assume. This doesn't mean that it wasn't there, but it does mean that we should be careful about how we treat the question, because, again, people talk of ordinary skills in magical terms for any number of reasons. If you take an extensive survey of how people talk about the sciences today, you would find exactly the same kind of talk; sometimes as figures of speech for talking about excellence or ideals in the field, sometimes as rhetoric to play up frauds or to win arguments, sometimes as symbolism for something else, sometimes as striking effects in science-fiction stories. Think about how mixed a group that is, and how strange the science of our day will look several centuries from now when people (other than historians of science) are no longer making a clear distinction among these different discourses. How benighted and foolish we will look!