Mark Twain is making a comedy out of what should be a sad occasion. The narrator is accompanying his best friend's corpse to Wisconsin to be buried. Through a combination of mixups, the corpse is left behind and the box the narrator believes contains the body of his deceased friend John B. Hackett actually is a crate filled with rifles; and somebody has set a package of Limburger cheese on top of the box. Naturally both the narrator and the expressman think the smell coming from the cheese is really the smell of the decomposing corpse.
What makes the story funny is that both men have to act as if they feel pity for the dead man, since this is the conventional thing to do. But the truth is that they feel nothing but loathing for the corpse because they blame it for the smell. Everything they do to try to cover up the smell only makes it worse. They are forced to keep sticking their heads out the window into the cold wind and then to spend half the journey sitting outside between the cars to get away from that foul odor. The weather is so cold and stormy that the narrator never recovers from the journey but, as the title implies, becomes a permanent invalid.
Mark Twain is creating laughter by exposing the hypocrisy of sentimentality. The narrator practically kills himself in trying to carry out the request of a dead man. The story resembles William Faulkner's short novel As I Lay Dying, in which a whole family of ignorant sharecroppers tries to transport a corpse by mule-drawn wagon to the dead woman's home town of Jefferson, Mississippi to be buried, and everything that could possibly go wrong does go wrong. Mark Twain's story, of course, seems contrived. It is very similar to the kinds of situations Charlie Chaplin used in many of his early silent short films. We know from the beginning that something is bound to go wrong.
The dramatic irony in the story is all involved with the fact that the reader knows (1) that the dead man is not really inside the box, and (2) that the smell is really coming from the Limburger cheese and not from a decaying corpse.