Why was the Atmega16U2 used on the Arduino UNO as a USB to Serial converter?
First reason I'd guess is price:


FT232 on octopart: USD2.65 ~ 3
Atmega16U2 on octopart: USD2.12 ~ 2.2


They can probably get much better deals considering that the Atmega328 is also from Atmel (now Microchip).

About the programming:

There are some projects which make the Atmega16U2 into a MIDI device over USB or HID, for example some repos: 1, 2, 3. I've used the second one I think, and it works fine.

You can program it with an ISP/ICSP programmer such as Atmel ICE(below) or Arduino ISP.



Use the ISP pins by the Atmega16U2: