There are TWO versions of every story. You feel that your HR round went well; in reality, maybe that is not the truth. Probably, that’s what HR might have thought. Secondly, the selection process doesn’t work the way you are thinking.
The Hiring Manager and HR conduct interviews with several people after which they shortlist 4–5 candidates for the final round. After the final round, they extend an offer to ONE of those 4–5 finalists. To select that ONE candidate, HR and the Hiring Manager, re-evaluate the entire list of finalists on parameters like CTC, the probability of early joining, cultural fitment, team fitment, attitude, etc. Therefore, though you made it to the final round, which in itself is a wonderful thing; unfortunately, you are not the one they like to go ahead with.
Good luck with your future job search.