A sunburn is something painful and harmful that we ought to avoid. People who have light-colored skin can easily get burned by the ultraviolet part of sunlight.
Sunburn causes real damage to the skin. Fortunately the skin is a part of our body that can regenerate by forming new cells and repairing damage. Otherwise, a wound or a burn would never heal.
Your skin is always growing slowly from new cells formed underneath the surface. Cells near the surface get squeezed down and their materials changed into a tough, horny, nonliving surface layer. That surface layer is always slowly peeling off at the outside.
When your skin is repairing itself from a sunburn, the damaged cells are pushed out faster. There is more of that non-living surface layer, and it may peel off in little patches that you can see. Then you say that your sunburn is peeling.