According to Freud, all of us have internalized the values of our culture and generally try to fall within the boundaries of acceptable behavior. However, sometimes we are met with negative stimuli which create a negative response in light of our culture's expectations. The id urges us to act on our primal instincts, yet the superego presses us to consider the moral implications of a negative response. Thus, sublimation acts to reduce the primal nature of the id in order to create a more favorable outcome.
Consider a common scenario: You have gotten in trouble at school. Perhaps your instructor even penalized your grade for something you truly did not do. You are suddenly filled with a sense of injustice and rage, a common primal instinct. When you get home, you grab your running shoes and take off on a 10K. When you return, your sense of rage has greatly lessened and you have also gained an additional advantage: you have made gains in physical health through cardiovascular exercise. This is sublimation.
Or consider that you have an urge to be unfaithful to your partner and know that another opportunity awaits you at a party on Friday night. Instead of going to the party, you choose to stay home and work on your English research paper, throwing yourself into the heavy academic work for hours. You have thus avoided a damaging situation and have accomplished the needed work for school ahead of the deadline.
According to Freud, sublimation is a way for us to make choices that are healthier, more productive, and more generally positive than those we might make based on our very primal and reactive emotions.