In primates small testicle size is correlated with how many males a female typically mates with. More males mating with the same female means the male that produces the most sperm has an advantage. So gorillas have tiny balls because every troop only has one silverback male, and chimps have horrifically huge nuts because there’s a lot of competition for mates from other males in the troop.
Interestingly, humans fall roughly in the middle of the scale in terms of ball size!