Jim ran away because Miss Watson was going to sell him down South.
Huck runs away from his abusive father, and soon runs into an escaped slave. While he lived with Miss Watson, Huck got to know Jim and appreciate him. When Jim told Huck that he had run off, Huck was surprised, but he promised not to tell anyone.
“Well, you see, it 'uz dis way. Ole missus—dat's Miss Watson—she pecks on me all de time, en treats me poorty rough, but she awluz said she wouldn' sell me down to Orleans. But I noticed dey wuz a nigger trader roun' de place considable lately, en I begin to git oneasy. (ch 8)
One of the worst things about being a slave is not having any control over your life, and being sold away from your family.
The question of whether to turn Jim in or not plagues Huck for much of the book. His conscience tells him to, because that is the law. It’s what is societally acceptable. Yet Jim is Huck’s friend, and he is a good person. Huck never does turn him in, and even tries to free him once he gets captured.
In Chapter Eight of The Adventures of Huckleberry Finn, Huck bumps into Jim on his fourth day on the island. Although Jim initially thinks that Huck is a ghost, he is eventually able to settle down and confess why he has run away from home: he had overheard Miss Watson planning to sell him to a slave trader for $800. Jim did not want to be taken away from his family and shipped off to New Orleans.
Ultimately, both Jim and Huck have fallen into a state of feeling alienated from the society that is trying to mold their lives in an unfavorable way. Their escape offers them a sense of freedom from the expectations of their previous lives and those who wish to control them.