Just recently I have made 6 batches of Mango Jam. All turned very dark brown while cooking and are almost black when jarred but they taste great. What is the reason for the color change?
I reckon it could be due to oxidation of fruits.
It's very common once you leave fruits that are cooked/uncooked in the open air. It probably helps if you could add a little salt in there ( even though it may seems weird, but it definitely works).
The reason why factory made jam does not turn dark at all is because of all the additional food addictive and preservative that is inside the food. I honestly, do not recommend keeping fresh mango jam for too long because it does go bad very quickly.
It happens to a lot of other food stuffs like potato etc.
It could be oxidation as Teo Chuen Wei Bryan has already said in their answer. It might also matter what sort of pot you cooked the jam in - metal pots other than stainless steel sometimes react chemically with the food and that could lead to darkening.