How data transfers to micro-controllers memory?
There are two ways of programming an AVR device.

The first is via an external programmer that interfaces with "hidden" hardware on the chip. The most common form of this is ISP, described in AVR910. Other methods exist, see the datasheet of the relevant AVR device for details.

The other is self-programming, which involves code running on the AVR device to accept the data to be programmed through one or more pins on the chip and then using special opcodes to write the data to flash and EEPROM. This is described in AVR109.

Note that "programming by USB" is actually self-programming where the bootloader opens a serial connection and the programming software sends the data through this serial connection. This is true both on devices with a separate USB interface chip such as the Arduino Uno as well as devices with integrated USB support such as the Arduino Leonardo.