Zen is the direct transmission of Shakyamuni's enlightened Mind, the Mind he realized when he saw the morning star rise blazing over the still-dark trees. As such, it doesn't rely on written or even on spoken words. Quick, run over & cut out my tongue -- if you can!
Bodhidharma brought this Mind to Mind transmission to China from his native India & gave it to several of his students. These students in turn gave it to other students, & so forth and so on. It's no different in principle than a fly buzzing from one dung-pile to the other on a hot summer's day.
But Zen is only understood when the Mind is directly experienced (in jianxing, "seeing the self-nature," Jap. kensho). Short of this experience, all Zen sayings are always going to seem illogical and jumbled.
Once you have this experience, the ancient texts become clear & laughably direct. It's like hearing cold wind blowing through the tops of pine trees. You understand without any explanation. "Bamboo of the South, wood of the North." It's all just so!