You can usually end a contract, such as a Mietvertrag (rental contract) or Arbeitsvertrag (employment contract). The contract says whether, when, and why you can end it. If the contract does not say anything about this, the law applies.
The Kündigungsfrist (notice period) is the time between giving notice and the end of a contract. In some cases, there is also a fristlose Kündigung (immediate termination). This means that the contract ends immediately when the notice is received.