Cancer treatment could be radically different depending on what form of the disease a patient has.
The gene, called androgen receptor (AR), promotes tumour growth in breast cancer when it is switched off, while in prostate cancer switching it on causes the cancer to develop.
Doctors discovered the gene's link to a protein called PTEN. The substance is a known tumor suppressor and has been associated with numerous cancers, although how it is regulated was previously unknown.
"We now see how androgen affects PTEN expression – and ultimately cancer," said Dr Charis Eng of Cleveland Clinic's Lerner Research Institute.
The findings show that cancer treatment must be customised towards a person's gender, she added.
Prostate and breast cancer are two of the most common forms of the disease in the UK, according to figures from Cancer Research UK.