From J.W. Jipp, Divine Visitation and Hospitality to Strangers in Luke-Acts, p. 136-139:
With the scene set as a divine visit of inspection in response to rumors of Sodom's injustice, "the two messengers/angels" come to Sodom "in the evening" and encounter Lot who is sitting at the gate of Sodom (19:1). Lot responds to their presence with proper hospitality. The messengers' initial resistance to Lot's invitation should not be understood as an attempt to reject shoddy hospitality but, rather, as a test "designed to judge whether his offer is purely perfunctory or genuine." The parallels between Abraham's and Lot's hospitable response to the messenger is obvious:
. . .
As with Abraham, there is no indication that Lot immediately recognizes the divine identity of his visitors.
. . .
One of the perplexing features of Lot's hospitality, however, is that the responsibility for welcoming strangers ought to have been practiced by citizens of the city whereas Lot is himself a "resident alien" (19:9). Has Lot, then, committed a transgression by welcoming these visitors? The answer is negative, for the story indicates that not one citizen of Sodom practices hospitality to strangers.
In other words, in context, the whole premise of God's test on the cities was how their residents would treat these seemingly random travelers. The point was that the cities were to show these men hospitality regardless of their anonymity. The irony is that a foreigner (Lot) showed hospitality, while the native citizens of Sodom showed hostility.
Lot assumedNeither Lot nor the menpeople of Sodom had any reason to assume the two 'men' were travelers; he didn't knowsomething other than foreign travelers. None of them knew they were interacting with angels until Sodom had already failed the test.