No. There is no legal regulation on this. However, in addition to payment of overtime, compensation in the form of time off in lieu may also be considered. The decisive factor here is what is regulated in your employment contract or in the collective agreement.
However, if compensatory time off is not possible, for example because the employment relationship is terminated, the employer is obliged to pay out the overtime that exists at the end of the employment relationship.