And GAIM was based on Gamera, the official AOL Linux client.
Pidgin and libpurple also have roots in another project called Everybuddy which was one of the first multi-protocol integrated free software chat clients. As I recall, Torrey Searle started Everybuddy because he was having a hard time getting traction on adding multiple protocols to GAIM at the time for a variety of reasons my hazy memory doesn't really remember.
For a couple of years after GAIM started to get plugin and multiple protocol support, much code was shared between GAIM and Everybuddy, and then eventually effort centered around just one of the code bases which eventually became Pidgin and libpurple.
Source: I was involved in GAIM early on and Torrey is a friend from those days.