The most obvious differences between Huck and Jim in Twain's novel are physical. Huck is a young boy while Jim is a man. Huck is white and Jim is black. As the friendship between them grows, however, the similarities become an important driving force in the novel.
Both Huck and Jim, for example, long for freedom from Miss Watson and the Widow Douglas, her sister. Both escape from the house in which these ladies make their home in order to achieve the freedom they seek. At first glance, this is a similar freedom, away from the boundaries the society of the time places on them.
The freedom they seek is not entirely similar, however. Jim longs for freedom from slavery. While his owner, Miss Watson, did not mistreat him, she did threaten to sell him to work at the plantations. This created such fear in the slave that he preferred to face being a fugitive. Huck, on the other hand, longs for freedom from the constraints of education, routine, and life indoors. In other words, he seeks to escape the privileged lifestyle that was available only to the rich and the white elite at the time.
While the bondage they experienced were not quite the same, neither Jim nor Huck had any enthusiasm for the lives they lived with Miss Watson. These respective lives are deemed appropriate by "civil" society. Both Jim and Huck have ideals that extend beyond the boundaries of society.
Hence, two freedom-loving souls find each other. In the symbiotic relationship they cultivate throughout the novel, Huck helps Jim achieve freedom, while Jim provides Huck with a moral compass that is more appropriate to his nature than Miss Watson or the rest of society can imagine.