Arduino after power on , bootloader will check USB if there is code available for uploading .
If not then program counter transf to code inside flash.
If there is code available from IDE and it will transfer from developing system to target board.
Draw back is some of the flash memory is used for the bootloader.