This phrase, butt of the joke, refers to a certain kind of joke—a joke at someone else’s expense. That is to say, a joke that makes us laugh at a person, or laugh at a person’s misfortune—the butt of the joke is the person who is being laughed at.
We can also use this phrase when there is no literal joke, but rather an ironic situation in which a person loses or has a poor outcome. For example, if a person stole a lot of money and then was caught when they tried to spend the money because the money was fake, we might say that they were the butt of the joke.
The word butt in English has many meanings that make sense here, including “the end of a used up cigar or cigarette,” “the blunt end of a stick,” and “a person’s rear end.” Few English speakers actually know which kind of butt is in this idiom! But this butt was, originally, the word for a cheap archery target—a tree-stump or a bale of hay at which people would practice shooting arrows. Which gives the meaning of the idiom perfectly. This meaning of the word butt comes from the 18th century and is no longer used in any other common phrases.