I love this question. It lets me gush about how important composing is, and the value of composing to music students. But, you ask, what does composing teach?
Composing helps students put theory to practice. We often talk about rhythm, time signatures, key signatures, degrees of the scale etc. Composing allows students to take this knowledge and apply it to their own original work.
Chances are a student will practice their own piece at home. I'm a firm believer that students who are motivated to go to the bench on a regular basis will develop good practice skills. Sometimes composing is a good jumping off point for this habit.
Many of my students find analysing their work easier after they have spent time composing. Understanding the tools of composition helps them to look at their required piece and break it down to find patterns making it easier to learn the required piece.
Students who compose tend to want to do more technical exercises because it helps them to compose in different keys and gives them more creative freedom with their own work.
On top of all of these great pedagogical reasons, when a student composes their own work they get to be creative and problem solve. They develop further as a musician. Plus it's great fun!