Joshua did not recognize the man. He did not know if he were friend or foe. He had to ask. Identity was uncertain. Israel is the 'am or people of Yahweh.
Identity is determined by relationship to Yahweh.
That relationship was open to any racial or cultural group, as evidenced by Rahab the Canaanite and Caleb the Kenizzite. This word became the name of the Israelites. Its origin is not cultural or racial but social and political. As indicated in chapter 2, the word probably is related to habiru or 'apiru . Scholars are not sure of the connection.