This idiom means that someone is playing a joke, or fooling someone else: ‘I don’t believe you. You’re pulling my leg’. It is good natured fun. A long time ago, though, when thieves would attack a person, one thief would hold and pull the person’s legs so that he could not escape. The other thief would rob the person.