Many common vegetables, including lettuces and cucumbers, are quite bitter in their wild state. Centuries of selective breeding by gardeners have made them milder and more palatable, but occasionally they'll still become bitter if growing conditions aren't ideal. If you've gotten a bitter cucumber from the store or picked one from your garden, you may still be able to salvage it.
Alkaloids called cucurbitacins create the bitterness in cucumbers. Occasionally they'll taint the flavor of an entire cucumber, but that's relatively rare. They tend to be concentrated at the cuke's stem end, and just under its skin. If you get a bitter one, lopping off the stem end and peeling the cucumber will usually restore it to palatability. In a salad or sandwich, any remaining hint of bitterness can usually be concealed by the other flavors. Some cucumber preparations, such as tzatziki, call for the sliced cukes to be lightly salted and left to drain in a colander. This extracts some of the juices from the cucumber and cucurbitacins as well.
Ounce of Prevention
If a store-bought cucumber is bitter, there's little you can do to prevent a recurrence, but in your own garden you have more control. Bitterness usually results from too much heat and too little water, and will go away if you increase irrigation. Cover the soil around the plants with a layer of mulch, to help retain moisture in the soil. If heat and drought are problems in your area, select non-bitter cultivars from your favorite seed catalog in the future. They're drought tolerant and less likely to produce unpalatable fruit.