This started out as an African American spiritual and hymn, and its exact origins are a little fuzzy--it seems to have grown out of a few similarly-titled gospel songs from around 1900. It really took off after Louis Armstrong recorded his famous jazz version in 1938, but the tradition goes back further than that: New Orleans brass bands used to play it at funerals, mourning the dead on the way to the cemetery, then breaking into a joyful, upbeat version on the way back. That's the same spirit that makes it such a fun, foot-tapping tune to play today.