The compound that imparts the bitter taste in cucumbers is cucurbitacin. Wild cucumbers have a large amount of cucurbitacin, which discourages feeding by wild animals and insects. Today’s hybrids have been bred to have lower amounts of cucurbitacin in the fruit and what cucurbitacin is in the plant is concentrated in the roots, leaves, and stems. In instances where the bitter compound is in cucumbers, it is more prevalent in the stem end than the blossom end. This has to do with coloration, since the compound tends to be in the darker green areas of the skin. This is also why cucumbers are sometimes peeled—to rid the cukes of the bitter taste. Misshapen fruit will also have more cucurbitacin than normal-shaped ones.
The cucumber variety as well as the growing environment will contribute to the development of cucurbitacin in cucumbers. Cool, wet conditions as well as hot, dry weather are major factors. While weather is beyond our control, providing water during dry conditions and mulching plants are the simplest ways to promote less bitterness. Deep, infrequent soakings will hydrate the deepest roots, encouraging growth where the soil is cooler.
The social media chatter about pollination by bees leading to the development of bitter compounds in cucumbers (by moving pollen from wild cucumbers to garden cucumbers) promotes a false understanding of how pollination works. If pollen is moved from a wild cucumber flower to a garden cucumber flower, the genetics for the trait of cucurbitacin production will be within the new seeds formed, not the fruit. The new cucumbers will remain true to the variety planted in taste and texture. It is when seeds are saved from this wild-to-domestic cross that there may be a problem, especially to seed savers and seed companies. The plants grown from these crosses will reflect traits of both parents and, if one parent is a wild cucumber, the cucumbers produced could be extremely bitter. Seed companies are well aware of the potential for crossing with wild types and will take necessary steps to remove wild plants from the surrounding area and isolate crops to ensure seeds are true to type.
More information about cucumber bitterness may be found here: https://extension.oregonstate.edu/news/cucumber-bitterness-explained