Just to clarify by an example: You borrow, say, $10,00.00 at 5% compounded annually, on Jan 1, 2023. Then you immediately make a payment of x dollars, and then pay x more at the start of each following year for 9 more years to completely pay off the loan with the 10 payments. You want to calculate the value of x, using the appropriate formula.
Well, imagine for a moment that you take out the loan on Jan 1, 2022 (one year early), with two other differences: You do not make an immediate payment, and the loan is for a reduced amount. Specifically, you borrow A, where
A = 10000/(1.05) = 9523.81. This amount is chosen so that, in the imaginary loan, by the time of the first payment of x, on Jan 1, 2023, your principal plus interest will be ... $10,00.00! You then imagine make all ten payments as scheduled in the real loan.
Your real loan and the imaginary loan now match in all important details: the amount you owe on Jan 1, 2023, and the amount and timing of all 10 payments. But the imaginary loan is just a simple or ordinary annuity paying off a loan of 9523.81 with 10 equal payments at the end of each year at 5% interest.
By discounting the the principal amount one payment period earlier, you have converted the annuity due to a simple annuity, and all the simple annuity formulae can be used with the revised numbers.
BTW, this answer does by hand-waving what is done with more rigor in the correct answer of @Chris Degnen