Found in 5 comments on Hacker News
This is mostly an O'Reilly thing.

https://www.oreilly.com/content/a-short-history-of-the-oreil...

TL;DR:

> Some of the people at O’Reilly were taken aback: they thought the animals were weird, ugly, and a bit scary. But Tim [O'Reilly] got it immediately—he liked the quirkiness of the animals, thought it would help to make the books stand out from other publishers’ offerings—and it just felt right.

They even have a browser which helps you identify the animal:

https://www.oreilly.com/animals.csp

eesmith · 2023-05-12 · Original thread
The source, https://www.oreilly.com/content/a-short-history-of-the-oreil... , is rather more interesting.

What was the first animal book? The Xlib reference manual (1990) does not use it. https://archive.org/details/xlibrefmanv115ed02nyemiss

Programming Perl (1991) used a camel. https://archive.org/details/programmingperl000wall

Ahh, Learning the vi Editor (1990) had an animal. https://archive.org/details/learningvieditor00lamb_0

So did Using C on the UNIX system : a guide to system programming (1989), https://archive.org/details/usingconunixsyst00curr . With a lion.

mbrd · 2020-04-08 · Original thread
O'Reilly-published books often have an animal on the cover. I don't think they are picked for relevance to the topic (even most of the Python books don't have pythons!)

https://www.oreilly.com/content/a-short-history-of-the-oreil...

pdpi · 2018-02-14 · Original thread
A lot of those are some sort of pun or reference on the topic at hand: The crab as as a reference to Ferris/Rustaceans on the Rust book, spiders on books for "webmasters", the snake on Python Programming, etc. Others were just assigned at random (and proceeded to become indelibly associated with the language, like the perl camel).

A list of the animals, and some history:

http://www.oreilly.com/animals.csp https://www.oreilly.com/ideas/a-short-history-of-the-oreilly...