Joseph had control over the land and it was his job to oversee the dispensing of food to the citizens of Egypt during the famine and authorizing it to be given to foreign purchasers as well. In perfect conformity to his first two dreams of the sheaves and the stars his brothers approach his throne and bow down to him. This must have shocked him to see this as he surely and clearly remembered the details of the dreams, his brother’s envy and resulting attempts by them to dispose of him. He realizes who they are but they do not know him. His reaction is one we would expect from one hurt badly; he attempts to conceal his identity and speaks harshly to them. He is still suffering from the pain they caused him and lashed out at them asking where they came from. In a natural progression from the pain they caused him he accused them of being spies and were looking for the unfortified parts of the kingdom so as to gain illegal access to the food themselves.