Why?
The goals of the Salmon change when they reach mating age. Now they don't need to survive in the ocean, they need to make sperm/eggs and survive the long trip to their birthplace. This trip is through fresh water lakes and rivers. That is a very different environment from the ocean. They will need to jump/swim up waterfalls. They will need to avoid predators, but very different ones than they faced in the ocean.At the end of their journey they will mate and die.
Because the goals and environmental pressures change so much the Salmon must also change to meet those new challenges. If they didn't they wouldn't be as successful in reaching their final destination and making more Salmon.
How?
Just like humans, hormones trigger biological changes. The change to fresh water also triggers changes and a countdown clock. The changes use a lot of energy, as does their trip and mating. Their body will literally consume itself to make the changes and meet the challenges it needs to so that the salmon make it home to mate.
In case anyone was curious