Scout is just defending her father's honour. The children call Atticus Finch a "nigger-lover" for defending Tom Robinson in court. Although she doesn't even know what such words mean, Scout knows from the tone that it is meant to be an insult, so she fights back in the only way she knows how.
Atticus tries to teach Scout to "fight" back with words instead of fists. He goes ever further to say that he indeed loves Negroes, as he should love all people.
Atticus also explains to both his children that the prejudice in Maycomb is a sort of disease afflicting even "good" people. The scene of his shooting the rabid dog wandering the streets is an implicit metaphor of Atticus's efforts to eradicate the "disease" before it spreads around and does even more harm throughout the community.