The change in color in a green pepper is the same kind that occurs in any other ripening fruit that changes color.
Chlorophyll breaks down or degrades, and other pigments are exposed or formed.
The complex ripening process is under the control of plant hormones like ethylene, a growth regulator that makes chlorophyll break clown, and auxin, the hormone involved when a leaf drops.
Auxin, in turn, is under the control of the day length or the amount of sunlight.
At the same time that the chlorophyll fades, the fleshy part of a fruit often softens, though this happens a little later in peppers, and starches and organic acids metabolize into sugars.
These changes make the fruit sweeter and more attractive to animals that eat them and spread their seed.
The whole purpose and strategy of a large fruit like that is to get its seeds dispersed, to get the products of its reproduction scattered about to find fertile ground to make new plants.