"Squawk" comes from the idea of a parrot--one says something to the bird, and the bird repeats it. The transponder was developed during WW II to differentiate friendly from enemy aircraft. Another term for it is "IFF," which stands for "Identify--Friend or Foe." The button that is pushed is called the "ident," or "Identify" button.
An interesting thing about transponders is that they use octal codes--that is, the usable codes range from 0000 to 7777, with no 8's or 9's. You don't want to use any codes that are in the "00XX" range, and you'd better have a good reason for using any "77XX" codes; those are reserved for certain types of emergencies.