WASHINGTON—China and Cuba have reached a secret agreement for China to establish an electronic eavesdropping facility on the island, in a brash new geopolitical challenge by Beijing to the U.S., according to U.S. officials familiar with highly classified intelligence.