Andy had begun to show signs of lethargy, decreased appetite and disorientation before she took a dramatic turn for the worse, becoming unresponsive to keepers and visually uncomfortable, zoo officials said.
Upon examination, the veterinary team discovered that Andy's abdominal cavity was full of fluid.
"Animals maintain a strong instinct and are known to hide their illnesses," said Connie Macdonald, curator of primates and carnivores, in a statement. "Keepers are always on alert, but it isn't until the animal's behaviors change dramatically that their caretakers know something is truly wrong."
An autopsy revealed Andy had a severely enlarged liver and lymph nodes, a mass at the base of her heart, and an enlarged spleen. The veterinary team also drained 11 liters of fluid from her abdominal cavity.
"This is always the hardest decision, but everyone feels this is the right decision for Andy," said Tanya Peterson, executive director and president of the zoo. "Andy was an ambassador for her species, and she will be deeply missed by everyone."
Andy was born at Zoo Atlanta on Christmas Day in 1982 and brought to the San Francisco Zoo in 1985. She spent her days with her fellow polar bear and companion, Piki, and loved pears and peanut butter.
The estimated lifespan of a polar bear is 20 to 25 years in a zoological park. The San Francisco Zoo has two remaining polar bears: Piki, 27, and Uulu, 29. Uulu is currently the oldest living female polar bear in North America.