The bank is giving you $X to buy the house. You’re paying off a piece of it each month (your mortgage payment). Part of that goes to the interest on the loan, the rest goes to principal. The interest each month is based upon on the remaining principal. That means your payment starts off being mostly interest and gradually becomes mostly paying off principal.
You could say, “But I can just save the full price and then buy the house with no interest!”. Sure you could. But you’re forgetting that you’re living in the house (or renting it out...) while you’re paying it off.