The sketch will be transferred to the AR9331, and the Linux distribution will program the ATmega32U4 through the SPI bus, emulating an AVR ISP programmer.
The Yún has a USB host port connected to the AR9331. You can connect USB peripherals like webcams, memory sticks, or joypads to this input. Generally, Linux has drivers included for the more common devices like mass storage or mice and keyboards. For more specific devices like webcams, you will need to refer to the device specifications to find the appropriate driver. As the USB port is connected to the Linux processor, it's not directly accessible from sketches on the 32U4.