This is not a specific rule, it is a result of the rules of the game and assumptions about PCs and levels.
As far as I know, no specific rule says: "A creature must have an intelligence score of at least 3 in order to pass class levels." Instead, it's a de facto rule that emerges from two parts of the rules of the game / underlying assumptions:
1. A creature with an intelligence score of less than 3 is not a playable character.
From the SRD:
Creatures with an intelligence score of less than 3 are not playable characters.
2 The game mainly assumes that only PCs take class levels by perfecting themselves.
The rules for gaining experience and moving to the next level (mainly from PHB, p.58) are all written as "you" or "your characterFor example, here's what he says about progressing to a level:
Advance a level: When your character's XP total is at least the minimum required for a new character level … he "rises to a level". For example, when Tordek gets 1,000 XP or more, it becomes a 2nd level character. As soon as he accumulates a total of 3,000 XP or more (2,000 more than when he had reached the 2nd level), he reaches the 3rd level. By raising a level, the character gains several immediate benefits (see below).
Similarly, the DMG (p.260) says:
Experience Points (XP): Fuel Level Advancement for Player Characters …
Even cases where a player controls a creature with an animal-level intelligence, such as an animal companion of the Druid, do not use the XP + class level system for advancement. instead, they have individual rules for advancement described by some class / feature / exploit / etc. granted the player control of the animal in question.
In short, all the rules of the game to track experience points and gain levels with XP are written to apply to players characters. Although I am not aware of any definitive statement to this effect, the general assumption of the rules of the game seems to be that NPCs and monsters will only be created by the DM with the statistics that are available. they consider it appropriate for the meeting, rather than having their own statistics. XP tracked and progressing when they gain enough experience.
Combine 1 and 2, it means that creatures with less than 3 Intellect never progress through level progression based on the experience.
Since creatures with intelligence scores at the animal level can not be PCs, and only PCs have a higher level, you end up with a de facto rules that animals never level. Thus, a creature of Animal Intelligence controlled by the player has no way to gain class levels.
This does not mean that the DM is never allowed to give class levels to creatures of intelligence at the animal level. As a DM, you feel that a vicious bear that has been corrupted by the influence of the shadows is better represented by setting two levels of Swordsage on the default statistics block of the bear brown, it's your prerogative. But it's not a special exception to a rule about class levels and Intelligence score – it's just an example of the general rule that DMs can build monster statblocks the way they want and not are not subject to the restrictions that the rules impose on players. when building PCs.