An invoice is the document where you settle a sale with the customer. When the invoice is created, the sale is posted: revenue, VAT and the customer's receivable are recorded in the accounts.
A credit note is "the reverse invoice". It is used when something has to go back — for example a return, an error or a price reduction after invoicing. The credit note reverses what the invoice posted.
An invoice can be created directly, from a sales order or from the checkout.
Once an invoice has been created, you do not edit it — instead you offset it with a credit note. That keeps the accounts correct and traceable.
Read more in Invoices and Invoice (quickguides).