In special ripening warehouses ethylene is released when the fruits have to ripen. This ethylene will initiate the ripening process and as a result the bananas themselves will also start producing ethylene. During ripening starch is broken down to sugars. That’s why a ripe banana is softer and sweeter than a green, unripe one. Some chemistry, starch is actually a long chain of glucose (thus sugar) molecules.
Bananas change colour during ripening because chlorophyll, which gives bananas their green colour, is broken down during the process. Since this molecule is broken down the other colours in bananas show up, which are carotenoids, more specifically, the xanthophylls. These are yellow colours and form one of the two main carotenoids.