What happens is the sun emits millions of waves of UV radiation, which is light particles to us. A wave of this UV radiation or light, takes about 8 minutes to get from the sun to earth, when the UV rays finally gets to earth, it is then filtered through our atmosphere, some light waves get in, but many bounce off.
jumping forward a few steps,
this light or UV radiation, penetrates our skin cells, about a couple inches or so.
the skin cells absorb the light, a similar process is seen by plants as photosynthesis,
and that's how we get a tan....
I hope this helps:)