According to InnerBody, the thymus shrinks from puberty onwards as its main role is completed during the childhood years. The main function of the thymus gland is to train immature T cells that are produced in the red bone marrow to become mature T cells that attack only foreign cells.
The thymus grows throughout childhood until the onset of puberty. InnerBody states that that the immune system creates most of its T cells during childhood. The immune system requires very few new T cells after puberty. Because the body no longer has the same need for new T cells, the thymus gland is no longer needed to the same extent.