Heck Tate is sheriff of Maycomb and therefore represents the laws of the land. Tom is in quite a predicament when he stops to help Mayella Ewell and she then tries to kiss him. Tom testifies that at about the same time, Mayella's very racist father stopped in to find his white daughter making sexual advances toward a black man.
During his testimony, Tom doesn't indict Heck Tate specifically, but he does explain the impossibility of his predicament due to his race. He couldn't use force to escape from Mayella, so his only option was to run. When Atticus questions his reasoning for this, Tom simply says,
Mr. Finch, if you was a nigger like me, you'd be scared, too.
Tom was aware that if the sheriff showed up to investigate, it would be his word (that of a black man) against a white woman. And the white woman would be believed—he had no doubt. In fact, when Mr. Gilmer follows up with his cross-examination, he questions why Tom ran and insinuates he did so because he'd have to face up to his actions. Tom responds,
No suh, [I was] scared I'd hafta face up to what I didn't do.
From the beginning, Tom didn't think that Heck Tate would believe him if called to the scene. He therefore believed he had no option but to flee.