Scout fights Cecil Jacobs in To Kill a Mockingbird because Cecil taunts her about Atticus defending Tom Robinson, and Scout sees that as an insult to her father.
Cecil tells their class that Atticus defends Black people, making it sound shameful. Scout does not really understand the Tom Robinson case yet, but she knows Cecil means to embarrass her and attack Atticus. Since Scout is hotheaded and used to defending herself and her family with her fists, she reacts physically.
That night, Scout asks Atticus about the accusation, and he explains that he is defending Tom Robinson because it is the right thing to do, even though he does not expect to win. He also asks Scout not to fight when people insult him over the case. The next day, Scout tells Cecil to take back what he said. When he refuses, she punches him. After that, she walks away because she feels she has to obey Atticus.
Scout later describes this change in herself: “After my bout with Cecil Jacobs when I committed myself to a policy of cowardice, word got around that Scout Finch wouldn't fight any more, her daddy wouldn't let her.” She still thinks not fighting feels cowardly, but Atticus is teaching her a different kind of courage: keeping control when other people try to provoke her.
The fight with Cecil marks the beginning of Scout’s struggle to understand Maycomb’s racism and Atticus’s moral courage. She is caught between her childish instinct to hit back and Atticus’s demand that she learn to stand firm without using violence.