It is Chapter Nineteen when the Duke and the King literally burst into Jim and Huck's quiet and tranquil lives by themselves living off nature. It is clear that Huck initially helps them because he feels pity for them and their claims of being pursued by men and dogs. Throughout the novel, Huck shows himself to be a basically decent boy, who likes to help when he can. However, at the end of this chapter, after their new guests have "introduced" themselves with their fake titles, we see that Huck continues to help them just because he has learnt that it is better to keep quiet and not look for a quarrel:
It didn't take me long to make up my mind that these liars warn't no kings nor dukes at all, but just low-down humbugs and frauds. But I never said nothing, never let on; kept it to myself; it's the best way; then you don't have no quarrels, and don't get into no trouble. If they wanted us to call them kings and dukes, I hadn't no objections, 'long as it would keep peace in the family; and it warn't no use to tell Jim, so I didn't tell him. If I never learn nothing else out of pap, I learnt that the best way to get along with his kind of people is to let them have their own way.
Note here how he is still influenced by his time with his father. This represents a key stage in Huck's moral development, where he does not stand up for what he knows and believes in, but rather takes a laissez-faire attitude to try and avoid trouble and conflict. This of course changes when he gets to know Mary Jo and sees how the Duke and King are going to trick her.