Most condoms are made from plastic and it’s quite easy to colour and flavour plastic things. Molecules for colour, flavour or smell can be incorporated into the plastic as it is made or formed into the required shape, or can be coated on afterwards.
As for why, well I’m sure the companies who make them have carried out lots of market research and found out that there are consumers who want it!
They impregnate (if you’ll excuse the pun) the latex with an essential oil – usually fruit flavoured – so when it sets the condom has the smell and taste of that fruit.
The reason they make flavoured condoms is because some people find the smell and taste of latex to be very unpleasant and so may not use them because of that. Condoms are such effective barriers to some sexually transmitted diseases, especiallly HIV, that it makes sense to try and mask the latex with another flavour to encourage more people to use them.