There's a book titled In the Buddha's Words which people recommend as an introductory text.
Anyway that book has, amongst other things, this to say,
Text IV,6(3), a long excerpt from the Assalayana Sutta, captures the Buddha in debate with a precocious brahmin pundit about the brahmins' claims on behalf of the caste system. In the Buddha's age the caste system was only beginning to take shape in northeast India and had not yet spawned the countless subdivisions and rigid regulations that were to manacle Indian society through the centuries. Society was divided into four broad social classes: the brahmins, who performed the priestly functions prescribed in the Vedas; the khattiyas, the nobles, warriors, and administrators; the vessas, the merchants and agriculturalists; and the suddas, the menials and serfs. There were also those outside the pale of the four main classes, who were regarded as even lower than the suddas. From the Nikayas it appears that the brahmins, while vested with authority in religious matters, had not yet attained the unchallengeable hegemony they were to gain after the appearance of such works as the Laws of Manu, which laid down the fixed rules of the caste system. They had, however, already embarked on their drive for domination over the rest of Indian society and did so by propagating the thesis that brahmins are the highest caste, the divinely blessed offspring of Brahma who are alone capable of purification.
Contrary to certain popular notions, the Buddha did not agitate for the abolition of the Indian class system and attempt to establish a classless society. Within the Sahgha, however, all caste distinctions were abrogated from the moment of ordination. People from any of the four social classes who went forth under the Buddha renounced their class titles and prerogatives, becoming known simply as disciples of the Sakyan son (that is, of the Buddha, who was from the Sakyan clan). Whenever the Buddha and his disciples confronted the brahmins' claim to superiority, they argued vigorously against them. As our text shows, the Buddha maintained that all such claims were groundless. Purification, he contended, was the result of conduct, not of birth, and was thus accessible to those of all four castes. The Buddha even stripped the term "brahmin" of its hereditary accretions, and hearkening back to its original connotation of holy man, defined the true brahmin as the arahant (see MN 98, not included in this anthology).
In summary:
- There was a caste system in the Buddha's time and place, but the system maybe wasn't so fixed or codified as it became later
- The Buddha said (in suttas and the in the Dhammapada) that it's how a person behaves etc., and not how they're born, that would make them a holy person
- The Buddha didn't try to abolish the caste system in lay society
- The Sangha however is "classless" e.g. the seniority between monks is based on how long they've been ordained, and not on how they were born.
You can find other people writing on this topic by doing a Google search for buddhism caste system. For example, this Glossary of Buddhist terms more-or-less agrees with the above, except that this text doesn't say, "Contrary to certain popular notions, the Buddha did not agitate for the abolition of the Indian class system and attempt to establish a classless society".
So Gautama needed to break that authority and misbehave
I don't know, maybe the question of authority and behavior is whether it's conducive to the goal.
A sutta like MN 26 suggests to me that he was willing to learn politely from the teachers of his day, but he assessed, evaluated, judged what he learned.
It's maybe not fair to say that he "misbehaved" in the sense of "behaved immorally" -- even in the Kalama Sutta where he tells people to not to base their decisions on "reports" nor on the thought that "This contemplative is our teacher", even so he recommends they do what's "blameless" and "praised by the wise".