First of all being called for interview is a huge achievement itself, so well done for that. There are a lot of reasons why it may not go your way on the day, and many are out of your hands, i.e., perhaps somebody else came personally recommended, or whilst you and your skills are great, they have a particular project running where somebody else’s skillset fitted slightly better at this time. Pat yourself on the back for getting that far, and now focus on the lessons you can gain that will help you in the future. Follow up with them to say thank you for the opportunity and ask for feedback. We know many people who got rejected at interview, only to be reapproached by the same employer several moths down the line for another opportunity because they made a good impression overall.