Both of these words are the past-tense of the word “hang,” but have different uses.* The word “hanged” is appropriate when talking about an execution, and the word “hung” is generally appropriate everywhere else. Thus,
The laundry was hung on the line to dry, and the traitor was hanged in the town square.
*I did a little research to try to figure out why this is true. According to Grammar Girl, who cites to The New Fowler's Modern English Usage, there were two different words for "hang" in Old English, which led to the two different past-tense forms.