1832, "one who digs clams from rivers and seashores," from clam (n.) + digger. Clam-diggers as a style of women's casual pants hemmed at mid-calf (supposedly resembling styles worn by those digging clams in mud) is by 1995.
bivalve mollusk, c. 1500 (in clam-shell), originally Scottish, apparently a particular use of Middle English clam "pincers, vice, clamp" (late 14c.), from Old English clamm "bond, fetter, grip, grasp," from Proto-Germanic *klam- "to press or squeeze together" (source also of Old High German klamma "cramp, fetter, constriction," German Klamm "a constriction"), possibly from a PIE *glem- or *glom- "contain, embrace" (see glebe).
If this is right then the original reference is to the shell. Clam-chowder attested from 1822. To be happy as a clam is from 1833, but the earliest uses do not elaborate on the notion behind it, unless it be self-containment.
mid-15c., "one who digs;" 1680s, "instrument for digging," agent noun from dig (v.). The communistic movement in England so called from 1649. Meaning "one who seeks gold in a prospecting place" is from 1853. In 19c. American-English, it was the name for degraded Native Americans in the West, who were so called for living chiefly upon dug-up roots (1837).
<a href="https://www.etymonline.com/word/clam-digger">Etymology of clam-digger by etymonline</a>
Harper, D. (n.d.). Etymology of clam-digger. Online Etymology Dictionary. Retrieved $(datetime), from https://www.etymonline.com/word/clam-digger