On the picture below is the output circuit of AC/DC adapter. I understand how voltage level contol works, but I don't understand how exactly current limitation works and how should I calculate resistors to get output current 2A for example? Could someone clarify this?
In your second schematic, opamp 2, is amplifying the voltage across the current sense resistor R2.
That voltage is simply the product of R2 and the current through the secondary side of the transformer.
Now, if that current is high, then the opamp has a very high output voltage. That means no current is sunk into the opamp output. If opamp 1's output also has high output voltage, then no current can be sunk there, either, turning off the LED in the optocoupler.
That Opamp1's output is also turned high when opamp2's output is high is ensured by the voltage divider R3R4-R5.