This is an old idiom. No one under the age of 30 or 40 would use it anymore (unfortunately). If you hear someone say this, it is either an older person (probably over 65).
Because cucumbers are mostly water, they remain cool and feel cool when you pick them up, even in a garden with the sun shining on them. This is what the idiom means: that someone keeps an even temperament when others would probably become angry, irritated, worried, embarrassed or other emotions that bring blood/heat to the face.