Usually people don’t get hired due to a simple reality: For that job the employer found someone more qualified or who met certain specifications you didn’t possess. Sometimes it is as simple as that. Don’t beat up yourself too badly if everything seemed to have gone right. It may have. It just went better for someone else.
While the preceding reason is most common, here are a few other reasons people do not get hired: inability to express skills and information clearly, lack of interest and enthusiasm, lack of confidence and poise, over-aggressiveness, too much emphasis on money, poor personal appearance, unwillingness to start at the bottom, or lack of tact and courtesy.
It is reasonable to seek feedback from the employer about why you did not land the job, particularly if you went far in the interview process. That information can help you hone your job interview skills for next time.