This story was very briefly mentioned in The Thirty Years War: Europe's Tragedy by Peter H. Wilson.
OK, so gotta stick a disclaimer on here. Two, if anything. The first is that generally, we don't mod where we post. It is bad form. I had no intention of answering this question Monday though, so I obviously was active, as you can see. Nothing removed really came remotely close to an answer, the closest being a quote from a primary source, one which I'll touch on myself, but falls quite short as it still doesn't actually say what he was doing! I'm answering it now, but have no part in its approval, which other mods will look over it to give, or deny. But anyways, as with a question that sits around and spurs curiosity, I did decide to do some research on this, and had wanted to answer it Tuesday, once it was clear the thread was dropping so that I'd feel no conflict of interest remained, but my early search for sources suggested the source I needed was not available as an ebook, so it was only this morning that the request I put in with the library got me the scan of the chapter I needed. So, with that all out of the way...
One of the descriptions that we have of the accident that Rudolf II experiences in 1591 comes from diplomatic correspondence, a dispatch written by the Venetian Ambassador, who recorded:
A week ago, while the Emperor was reading a book upon fireworks he suddenly conceived the idea to try an experiment with some spirits of wine and gunpowder. As he was leaning over the the boiling spirits, which had been boiled and re-boiled, and was therefore almost pure spirit, it flamed up and burned a part of his beard, both his eyebrows, and his cheek. Thank God he has suffered very little, though the danger was great. He is in retreat at present.
Apparently the death of the Master of Horse was not important enough to mention... or perhaps Rudolf exploded multiple things that year! In any case, while this gives us a few details about what the concoction Rudolf was playing around with happened to be - alcohol, gunpower, and fire, which seem to be a bad combination - it doesn't say what he was actually up to. Which was alchemy!
A 1606 description of Rudolf II by his critics sketches him thus:
His Majesty is interested only in wizards, alchymists, kabbalists and the like, sparing no expense to find all kinds of treasures, learn secrets and use scandalous ways of harming his enemies. [...] He also has a whole library of magic books. He strives all the time to eliminate God completely so that he may in future serve a different master.
Rudolf's obsession was not just with his own dabbling (and to be sure, no source seems to say exactly what he was hoping would result in this specific instance) but also included patronage of others to pursue the alchemial arts, such as John Dee or Edward Kelley. But an important caveat of course must be made, namely that in a modern context we might consider alchemy to be an absurd pseudoscience, and the endeavors that Rudolf and his contemporaries were engaging in to not be worthy of the name "scientific experiment", it is just that, a modern lens. The idea of "science" and "pseduoscience" is a frame alien to those of his time, and even "experiment" is an awkward term to apply since the frame in which we understand that, the scientific method, would not have been taken into account then either, so it meant something somewhat different in that period. Newton himself had a perhaps unhealthy interest in alchemy, and it simply lacked a clear delineation of what it wasn't, encompassing science (as understood in the time), with religion, philosophy, medicine, and chemistry, to name a few. It was in many ways a worldview as much as it was a mere pursuit.
Rudolf II thus wasn't only a patron of alchemy, but rather he was a patron of the arts and sciences as understood at the time, and while alchemy was one of his key focuses, it was not the only one. It fit within that broader framework of royal sponsorship, which in Prague included not just avowed alchemists, but also men well remembered for their contribution to the proto-scientific field such as Brahe and Kepler. They too illustrate the lack of a divide of course, Kepler not only an astronomer, but an astrologer, and one who Rudolf took so seriously that Kepler became afraid to give astrological predictions when it became clear the Rudolf took them so closely to heart! Great artists too were lavishly supported, the works of whom helped Rudolf II amassed a vast collection.
To get back on track though, what alchemy did have was a strong religious element, as the quote above might have clued you into. Its adherents believed it to be a godly pursuit, while its opponents chalked it up as black magic. Alchemy in the 16th century fit into the broader landscape of the Reformation period, resting itself atop the confessional divide of the Protestant and Roman Catholic faith. Grounded in a humanistic approach that embraced the potential for man's mortal perfection, to its opponents within both faiths it was a rejecting of the religious norms of both, steeped in original sin, human depravity, and the need for God to save us; to its practitioners, also to be found in both faiths, it was not a rejection of orthodoxy at all, merely an exploration of God's world, a "search for the Creator through his created works".
Although best remembered as 'trying to turn base metals into gold' and seeking the 'Philosopher's Stone' to gain immortality, alchemy had a much deeper quality for those who practiced it, seeking out "the moral and spiritual rebirth of mankind." A representative example might come from the work of Michael Maier, who had been sponsored by Rudolf II for a time, and wrote several works which he argued all symbols are alchemial, and unlocking the reality of their meaning can 'offer a progressive revelation of truth'.
For Rudolf II, his alchemial pursuits fit into a larger spiritualism, an interest in the magical, and also a belief that he was beguiled by evil, which he to a degree embraced, such as supposedly ordering necromancer in his employ to place a curse on his brother Matthias, for some apparent slight. A number of those in his circle repeat similar quotations to that of him allegedly remarking:
I know that I am dead and damned; I am a man possessed by the devil.
Even if only alleged, certainly others around him believed it. The Papal Ambassador wrote to the Pope in 1600:
It is generally agreed amongst Catholics in Prague that the Emperor has been bewitched and is in league with the devil. I have been shown the chair in which His Majesty sits when holding conversations with the Prince of Darkness himself. I have seen the little bell His Majesty uses whenever he wished to summon the spirits of the departed to do his bidding.
In any case, to return to the focus, the Rudolfine Court in the late 16th century became on of the focal points of alchemy in Europe, at a time when interest in it was at a fever pitch. Rudolf II's interest in this art brought many aspirants to his court, where the collection of alchemists he sponsored are known to posterity as the Rudolfine Circle, although also known to posterity through a hazy cloud of half-truths and romantic imaginations. Many members came and went, gained and fell from favor, and what can be said with certainty is that Rudolf's Court was a thriving center for alchemy over several decades, producing a number of works on the subject, if, presumably, a lesser amount of gold and immortality.
It is interesting too to see how interest in alchemy fit into Rudolf's other pursuits in the arts and sciences. Aside from, as already noted, the lack of what we today would call a clear division for the latter, the former intertwined too! Rudolf's patronage of the arts resulted in many gorgeous works, and the material to create them was of course a necessity. What better way to supply this demand than finding ways to create those gems and metals from the cheaper stuff? Sponsorship of mining, and the improvement of mineral extraction not only was a focus of Rudolf, but was overseen by men with interests in alchemy, pursuing both efforts simultaneously.