Do "elephants have 40 cancer-fighting proteins in their DNA?" Elephants have 40 copies of a single cancer-fighting protein. This means they have a lot more of that protein than humans.
Do elephants rarely get cancer? They get cancer about as much as other animals. The fact that they don't get cancer more is surprising because they are big and long lived.
This scientific paper examined "cancer resistance in large and long-lived organisms, including elephants."
Every time a cell in your body divides there is a tiny chance that its DNA will not be perfectly copied, a mutation. A larger animal has more cells, and therefore more cell divisions and more chances to have cancer causing mutations. Longer lived animals have more time to build up cancer causing mutations. Therefore it makes sense that elephants, being large and long lived, should have cancer all the time, but this is not the case. This contradiction between the intuitive explanation and actual observations of cancer rates is known as Peto's Paradox.
The linked paper suggests that elephants may be more cancer resistant because they have additional copies of the gene TP53.
TP53 (encoding the protein p53 [RefSeq NM_000546]) is a crucial tumor suppressor gene, mutated in the majority of human cancers. Referred to as the “guardian of the genome,” inactivation of p53 leads to 3 cancer cell characteristics including suppression of apoptosis, increased proliferation, and genomic instability. Humans contain 1 copy (2 alleles) of TP53, and both functioning alleles are crucial to prevent cancer development. Absence of 1 functional allele leads to Li-Fraumeni syndrome (LFS), a cancer predisposition with more than a 90% lifetime risk for cancer, multiple primary tumors, and early childhood cancers. Understanding the cellular mechanism of cancer suppression in animals could benefit humans at high risk of cancer, such as patients with LFS, and even the healthy, aging population.
Humans have 2 copies of the gene TP53. 2 copies is the least number of copies of a gene you can have. This gene protects us from cancer. Humans with one disabled copy are at a high risk for cancer. Elephants have 40 copies of this same gene.
While humans have 1 copy (2 alleles) of TP53, African elephants have at least 20 copies (40 alleles), including 19 retrogenes (38 alleles) with evidence of transcriptional activity measured by reverse transcription polymerase chain reaction. In response to DNA damage, elephant lymphocytes underwent p53-mediated apoptosis at higher rates than human lymphocytes proportional to TP53 status.
The P53 protein is made by the TP53 gene. The P53 protein is responsible for telling the cell to commit suicide if its DNA has been damaged. Because elephants have 40 copies of this gene, they have a lot more of the protein than humans do, and their cells are quick to destroy themselves when their DNA is damaged. This helps elephants not get cancer.
The second part of the question is about the actual rates of cancer in elephants compared to other animals.
The supplementary materials for the paper, give data on the rates of tumors in a wide variety of zoo animals. They give graphs of tumors vs body size, metabolism, and lifespan. Elephants are lower than the average animal, but they still get cancer.
This data doesn't do a great job answering this part of the question. The researchers looked for tumors in 644 animals of 36 species. On average each species had a sample size of 18. Although this is not a great sample for establishing cancer rates in a single animal species, it is enough to show that there is not a strong trend towards cancer rates in larger species.