Once a man went to the south, but his carriage was heading north.
A passer-by asked him: "If you are going to the south, why is your carriage heading north?"
The man said, "My horse is good at running, my driver is highly skilled at driving a carriage, and I am rich."
The man didn't care the direction might be wrong; the better his conditions were, the further he was far away from his destination.
This idiom came from this story tells that one's action was the opposite effect to one's intention.