Fundamentally, no, alchemists weren’t right.
Well, to be even more fundamental, “alchemists” aren’t a coherent group or a consistent philosophy. It’s a term that’s been broadly used by a lot of different people over the course of several hundred years, and it covers a lot of very-different things. “Lead into gold” isn’t even necessarily a goal of all alchemists—and for some, it’s not literal in the first place, but rather a symbolic spiritual transformation.
Anyway, for the most part, Western alchemy is based on the ideas of some ancient Greek philosophers, most notably Plato and Aristotle. A lot of work along those lines was performed in Hellenistic Egypt, and then after the fall of the Roman Empire, moved to the Arabic world. With Europe’s Rennaisance, they discovered the work in Arabic and moved on from there.
Alchemical theory comes from that lineage. Plato’s four elements, air, earth, fire, and water, play a large role, as do the underlying “qualities” of dryness/wetness, coldness/hotness that they were supposed to be made up of. The chemical processes of calcination, dissolution, separation, conjunction, fermentation, distillation, and coagulation were espoused by the possibly-mythical Jābir ibn Ḥayyān, known in Europe as Geberus or Geber, as the fundamental processes by which alchemy is wrought. Those seven processes are paired with seven forms of matter, seven days of Creation in Genesis, seven planets, and so on. Numerology, as the repetition of “seven” suggests, became a big part of things. So did a number of other mystical and esoteric practices—astrology, for instance, was always closely linked with alchemy, and that only got tighter. Many alchemists believed the summoning of spirits—angels, demons, djinn, etc—was crucial to transmutation. By the seventeenth century, Kabbalah, a Jewish mystic practice, was heavily entwined with the practice of what was then called alchemy. And so on.
And all of that was basically wrong. Plato was wrong, Aristotle was wrong, numerology is meaningless, the pseudo-religious mysticism I won’t call right or wrong but it certainly doesn’t notably contribute to physical knowledge, and so on. Jābir ibn Ḥayyān produced some really genuinely useful data on various chemical processes and what they resulted in for various ingredients—and so did many other alchemists before and after that—but all of it was ensconced in a theoretical framework that was simply inaccurate, and this led to many beliefs about those processes that were incorrect.
And ultimately, even if we ignore all the mysticism and everything, those seven chemical processes will never contribute in any significant way towards the transmutation of any element into another. Alchemy isn’t just “turning lead into gold,” it’s “turning lead into gold via the application of these processes in the right sequence with the right combination of ingredients,” and that approach is simply not ever going to work.
It is really telling that the trend with alchemy was towards the mystical and esoteric. Early alchemists produced better and more useful results than later alchemists, because the early alchemists had more “low-hanging fruit” to reach regarding basic empirical facts (not to call the work performed easy—many doubt the historicity of Jābir ibn Ḥayyān precisely because the amount of work required to produce everything attributed to him is more than any one man could hope to have performed). But once the empirical facts were determined as well as they could be with the tools they had, alchemy kind of devolved. It was initially assumed that once you had all the facts you’d be able to analyze them to figure out how to solve the various primary aims of alchemy, but that didn’t happen. And rather than throw out what wasn’t working, alchemists just got more and more mystical, until eventually it wasn’t even about physical substances at all.
On the other hand, chemistry was founded on more scientific principles—which, to be fair, didn’t exist when alchemy got its start—and while it could be said that eventually chemistry also settled on a theory by ancient Greek philosophers—Leucippus and Democritus rather than Plato and Aristotle—it happily threw out almost everything from that philosophy beyond the word atomos itself. Chemistry was founded largely in opposition to alchemy, rather than as a development of alchemy. Maybe if scientific ideas had debuted earlier, alchemy could have pruned itself of its philosophy and mysticism in favor of the scientific method, and we’d be using the word “alchemy” to refer to modern science, but that’s not how things happened.
Also, it’s worth pointing out that ultimately, it isn’t chemistry that transmuted one element to another, either. Obviously, atomic theory and the work that chemists had done to isolate the elements and build up the periodic table were absolutely crucial to the development of nuclear physics, but it’s still nuclear physics for a reason. Which means that, really, alchemy is yet another step removed here.