This happens in Chapter 15. We are not exactly told why the two kids will not obey and go home, but I think we can make a pretty good guess.
I believe that the kids feel a great deal of loyalty to their father. He has raised them alone and they respect him a great deal. In Jem's case, he is probably feeling that he is becoming a man and should act like a man.
For both of these reasons, the kids would not want to abandon their father when he is in danger. That is why they stay with him, in my view.
I agree. There is an interesting duality. Jem has a more direct sense of the danger involved and that is shown in his emphatic resolve to stay in defiance of his father. Scout, however, is more innocent and in her words to Mr. Cunningham we see that does not see what should bring this crowd to threaten Mr. Robinson. Scout and Jem show the vision of all these events through the lens of Scout's innocence and Jem's growing experience.