If you dream about having cancer, it does not mean you actually have the disease. Cancer is a symbol for other problems, illnesses and intangible issues like stress. Dreaming about having cancer may be a signal sent from an internal organ, to inform that it needs medical attention.
If you personally know of somebody who has cancer, or who has fought the cancer battle, then your brain is full of information and stories about them. The brain processes this data and creates a message in a dream.