The characters literally combine to tell the story: “to carve the boat to seek the sword.” The meaning is completely derived from this memorable fable.
This idiom is almost exclusively used with a negative and critical connotation. It’s a common and effective way to criticize a person, a plan, or a policy for being rigid and out of touch.