Why is one of those spelled with a single L and not the other?
For the etymology of Beryllium name it’s unclear but could be either Greek or Latin, and Helium is named after Helios (so Greek here).
As the comments have said, there isn’t any reason to expect these two different words to be spelled with the same number of Ls. The use of double consonant spellings in English is often related to either pronunciation or etymology.
The spelling of helium can be explained in terms of pronunciation. Helium has a “long e” sound in the first syllable. Double consonants are not usually used after vowel letters that represent “long” vowel sounds. “Hellium” would only be a plausible spelling for helium if the first syllable were pronounced with the vowel of hell rather than with the vowel of heel.
The spelling of beryllium can be explained in terms of etymology. As mentioned in the comments, both Greek βήρυλλος and the derived Latin beryllus have a double consonant in the same position.
Etymology also works as another way to explain the spelling of helium, since Greek ἥλιος has a single λ.
The spelling of beryllium can’t be explained in terms of pronunciation alone. A word spelled berylium would likely be pronounced the same way: compare syndactylia, which has a “short i” sound in the third syllable even though it is spelled with a single L. The “short i” pronunciation of Y in this context follows a rule that I explain in my answer to the question Why do we pronounce a long second vowel in “decide”, but a short second vowel in “decision”?
In my answer to Adding an L when appending an -ium suffix to a word? (Metallium vs. Metalium), I give more examples of words that are spelled with double L for etymological reasons.