The river is a hero because it takes Huck and Jim away from their terrible lives of abuse and slavery.
Although it is the setting, the Mississippi river is also a character in The Adventures of Huckleberry Finn. As Huck travels down the river, he symbolically travels the river of his conscience.
Huck’s fascination with the river begins early in the book, when he sits looking out at it with Tom Sawyer.
[The] stars over us was sparkling ever so fine; and down by the village was the river, a whole mile broad, and awful still and grand. (ch 2, etext pdf p. 9)
This idyllic description of the river foreshadows its importance in Huck’s life. Even at this point, the river represents freedom. When Huck’s father forces him to go to the shack by the river, Huck notices that the river has “begun to rise” as if it is already planning his escape (ch 7, p. 24). When Huck escapes, his time on the raft is the happiest and calmest he has ever been, “powerful lazy and comfortable” (ch 8, p. 28).
The river does not just represent freedom for Huck, it also represents Jim’s freedom. When Huck finds Jim, he has to make his first choice. He promises Jim he won’t tell anyone that the runaway slave is hiding on the river, even if they call him a “low-down Abolitionist and despise him” (ch 8, p. 32). Huck reminds Jim he is not going back there. They just enjoy each other’s company and the freedom.
On the river, Huck and Jim are equals. Their problems are behind them, unless they talk about going onshore.
It was kind of solemn, drifting down the big, still river, laying on our backs looking up at the stars, and we didn't ever feel like talking loud, and it warn't often that we laughed—only a little kind of a low chuckle. (ch 12, p. 45).
In fact, the only time trouble is caused is when they go on-shore, such as when they are with the King and the Duke or when Tom is planning Jim’s escape. On the river, everything is good.