The Torah has already informed us (in the previous Pasuk) that Yosef recognized his brothers. Why does it repeat it here?
Rashi #1: The Torah is pointing out here the difference between him and them; he recognized them because when he left them they already had full beards, but they did not recognize him because his beard had not yet fully grown.
Rashi #2: On a more spiritual note, it is pointing out that when his brothers fell into his hands, he had mercy on them and treated them as brothers, whereas when he fell into their hands, they did not treat him as a brother.
Ramban: After they told him that they came from Cana'an, any remaining doubts were dispelled and he knew for sure that they were his brothers.
Ramban (citing the Ibn Ezra and Seforno): At first, he merely recognized them as a group, and then individually.
Why did Yosef's brothers not recognize him?
Rashi and Rashbam #1: Refer to 42:8:1:1.
Ramban: Because, unlike Yosef, who anticipated their arrival, it would never have occurred to them that the brother they had sold as a slave to the Yishme'elim was the ruler of Egypt.
Rashbam #2: Because they now saw him as a royal figure, wearing royal robes. 2
רש"י: שיצא מאצלם בלא חתימת זקן: למה היה צריך להוסיף "ויכר יוסף את אחיו"?
גור אריה: לכאורה קשה כיצד אמר יוסף שהם מרגלים ולא חשש שהם יכירו אותו? לכן בא הפסוק ללמדינו שהוא היה יכול להכיר אותם והם לא יכלו להכיר אותו כי הוא יצא בלא חתימת זקן.
רש"י: ומדרש אגדה וכו': למה הביא רש"י את המדרש?
גור אריה: לכאורה מספיק לכתוב 'ויכר אותם יוסף' שהרי ידענו שהוא מדבר עם אחיו? אלא לומר שהוא ריחם עליהם כאח.