I’m disappointed for you! And I completely understand that you are feeling discouraged. It’s a normal part of the job search process.
What does it mean to not get a job you want? I’ve come to see that it means a) it wasn’t the right job for me and I can be grateful I was spared the agony of a bad fit; and b) the right job is on its way and is that much closer. The fact that you got an interview, and you did so well in the first interview that you got a second interview – it means that you are pretty clear on what you want and very close to getting it.
So “courage, ma amie!” as they say in French. I encourage you to allow yourself some down time – an hour perhaps – and then to look critically at the job itself and see what wasn’t quite the right fit for you. That will help us focus more clearly on what you really want. And your clarity will help the right job appear.