When people called something a disaster, they once meant it was the stars' fault.
The word is built from two Italian pieces. The first is dis-, which here is not a simple "not" but a prefix of ill fortune, much like the mis- in "mishap." The second is astro, "star," from Latin astrum and Greek astron. Put together, disastro meant roughly "ill-starred."
That was a technical idea, not a figure of speech. In the astrological thinking of the time, a bad outcome could be traced to an unfavorable position of a planet or star. Merriam-Webster describes the original sense as "an unfavorable aspect" of a heavenly body. A disaster was the harm that such an aspect was believed to cause.
Italian passed the word to French, where désastre is recorded in the 1560s. English borrowed it from French. Etymonline dates English use to the 1590s, while Merriam-Webster gives about 1567, so sources differ by a few decades on exactly when it arrived.
Over time the astrology faded and the sense widened. A disaster became any sudden, ruinous misfortune, whatever its cause. The adjective disastrous shows the same drift. It appears in the 1580s with the now-obsolete meaning "ill-starred," and by around 1600 it meant simply "calamitous."
Older English had its own word for the idea. Etymonline records lond-sorwe, "land-sorrow," from around 1200, for a calamity that struck a whole country. It named the result, not the supposed cause.
The star in disaster is the same star found in astronomy and in English star itself, all traced to a Proto-Indo-European root meaning "star." English also has a direct translation of the Italian idea: ill-starred, which carries the astrological blame in plain Germanic words.
So the next time a project goes wrong, the etymology offers a small excuse. The word itself says the stars were against you.