T-cells are part of the immune system.
The sunlight-vitamin D connection is often used as an analogy for ionizing radiation hormesis. The point being made is that low levels of UV radiation are good for you, therefore low levels of ionizing radiation are good for you (absent any vitamin D component of the analogy!). Though the net impact of low amounts of sunlight are good for you, while you're absorbing the sunlight you're also increasing your risk of cancer. It's just that the net effect is beneficial.