The green color in unripe bananas comes
from chlorophyll, the same pigment that gives green leaves
their color. As bananas ripen, the chlorophyll breaks
down and disappears, revealing the yellow color which
has been there all along. The yellows and oranges of autumn
leaves are also revealed as their chlorophyll breaks down.
Of course, other changes also occur as bananas ripen:
the starches change to sugar and the flesh softens as
pectin (a carbohydrate) breaks down.