吃瓜 comes from the image of bystanders casually eating watermelon seeds while watching a spectacle. 吃瓜群众 (melon-eating masses) refers to curious onlookers who follow celebrity scandals or internet drama without getting involved.
usage
瓜 alone can mean 'gossip/drama' — 有瓜 means 'there's tea/gossip,' and 大瓜 means 'big scandal.'