The term “white elephant” comes from ancient Siam, where no one but the king could own a rare and sacred albino, or white, elephant without royal consent.
The cost of keeping any elephant, white or otherwise, was enormous.
So when the king found displeasure with someone he would make him a gift of a white elephant
Because the animal was sacred and couldn’t be put to work, the cost of its upkeep would ruin its new owner.
Something useless and expensive is called a “white elephant”.