Jim is agitated by the creatures that Tom and Huck introduce to his hut. He says that there isn’t hardly any room for him, and that the creatures are very lively when he tries to sleep. The spiders and rats bite him (he uses his blood afterward to write in his journal); he says he never wants to be a prisoner again, especially after the boys saw the legs of his bed and all three eat the sawdust together to hide the evidence, which gives them all terrible stomachaches.
Tom and Huck dehumanize Jim in this scene by ignoring his pleas and cramming his room with various, dangerous creatures. That said, they also endanger themselves by catching the creatures and eating sawdust and the like, which suggests that their disregard of human safety is less a factor of racism, say, than general immaturity.
After all preparations are completed, Tom says that he and Huck need to write an anonymous letter to warn the Phelpses that someone is going to try to rescue Jim. Huck mildly protests but soon gives in to Tom’s plan. The boys leave notes and ominous warnings around the Phelps house that terrify the family. Tom also writes a note saying that a gang of cutthroats will try to steal Jim.
Tom’s plan of the anonymous letter is supremely immature and irresponsible: it terrorizes his family needlessly, and it jeopardizes the success of Jim’s escape, which would be much better conducted in total secrecy. What is clear by now is that while Huck wants to free Jim, Tom is playing a game. For Tom, his games come before other people. For Huck, people always come first.