The Atmel description of Atmega328 does not give me enough details to understand how the analog input can power the controller.Yes it does - chapter 18 - I/O ports describes the protection diodes between the pins and Vcc/gnd, and shows them schematically in figure 18-1. Furthermore, Table 32-1 Absolute Maximum Ratings specifies that the voltage on any pin must not exceed Vcc by more than half a volt - when the unit is not powered, Vcc is 0, but you're putting 5v onto an I/O pin. Like most digital IC's, each pin has an internal diode between it and Vcc and Gnd, to prevent the voltage from exceeding Vcc or being lower than ground - in your case, you were backpowering it through that protection diode - a diode meant to handle only very low current.Up to now the controller survived and still is working.But can it be dangerous for the controller chip when it is powered via A7?Yes, it is the easiest way to blow a pin.In a future circuit not only the charging circuit but also the Nano shall be powered via external 5V using the pin "+5V" on the Nano. From the schematic of the Nano this should be no problem.Is this really ok?Yes if it's a nano or pro mini (thanks to the diode and simple power circuit). Boards without the diode, that use some other power supply circuit, like the Uno/Leo/Mega, will often damage the 16u2 serial adapter if you plug them into USB while external 5v supply is connected (the clones use other serial adapters that are less susceptible to this, but they can still be damaged).