Bananas turn yellow when they ripen due to the decreased amount of chlorophyll, in a process similar to leaves turning from green to red. However, not all bananas turn bright yellow, and some varieties have red, purple or green skins even when ripe.
The yellow color in a banana indicates that the peel is beginning to deteriorate and releasing sugars into the rest of the fruit. This is when the flesh of the banana becomes less bitter and starchy. The decrease in chlorophyll, which is what causes plants to appear green, allows pigments called "xanthophylls" to show their yellow color. Xanthophylls are the same pigments that appear in yellow leaves, egg yolks and papayas.