Chacha20 consist of two parts: initialization state and encryption as shown in the following figure:
Initial state is generated by the input 256-bit key, 32-bit counter, and 96-bit nonce. In the encryption, a new 512-bit key is generated and is used for doing XOR with 512-bit plain text, then output a cipher block in each iteration.