Your professor will need to work closely with his intern, so likely selected a student who showed continued interest and well as someone whom he felt would be open, ask questions, share insights, etc. All this in addition to someone he thought could be helpful to his project.
You need to understand what it takes to succeed In the “real world”. Grades and aptitude got you to where you are, but going forward you will be evaluated on the how you work and your relationships with other. You may be able to do the work; but you also need to to be personable, kind, helpful, curious, etc. The people who get promoted and move forward are those that have the people skills to lead and inspire and mentor.
CS interviews at the top companies require passing a coding assessment and well as behavioral interview questions. You may get the job without passing the latter, but you won’t move up far in the company.
This is why most colleges want students who are well rounded, volunteer, participate in extra curricular activities, have diverse background/interests; not just the students with the highest GPA and SAT Scores. The better schools knows what it takes to succeed in life and don’t just want to give out degrees so graduates to get and sit in an entry-level position for 30 years. These Schools want to build leaders who are successful, can give back, and represent their alma mater well.