How can one get thymus cancer?

Same as anywhere. All you really need to do to get thymic cancer is have a thymus. Cancer is an overgrowth of cells which have lost their responsiveness to the normal signals of the body; this is why they break free and go elsewhere in the body (metastasize).