The poem is about a freezing-cold winter trip in the Yukon, back in the days of the Klondike Gold Rush. The poem’s speaker tells us a story about his friend, Sam McGee, who freezes to death on the trail.
Sam hates the cold and doesn’t want to be buried in the frozen ground. So, as his dying wish, he asks our speaker to cremate him (which is a fancy way of saying "burn his corpse"). The speaker promises he will, but it’s tough to find a way to do it in the dead of winter. He ends up having a lousy trip, carrying Sam’s frozen corpse until he finds a spot to burn Sam’s body.
He starts to burn Sam, but is pretty grossed out by the whole thing. Then, when he goes to see if Sam is "cooked," he finds his friend alive and well and cozy! Apparently Sam just needed to defrost a little, and the raging fire did the trick.