From IFWiki

What the player is supposed to be doing at any given time.

Goals are to interactive fiction what plot is to normal fiction: they provide something to motivate and hang events off. In the earliest games, the goal was typically to acquire treasure and put it in a special place, usually suggested by text at that place. Other goals would be to accomplish a mission. For example, the first Scott Adams adventure, Adventureland, had as its goals to collect and deposit treasure items. The third, Mission Impossible, gave you a mission via tape recorder at the start of the game.

One important role of goals in interactive fiction is that they make the world seem more real. Any computer simulation is far less richly detailed than the real world. If a player is trying actions at random, or examining random things, most of these will fail in an unsatisfying way. If the player is following a goal, then the player actions are more focused, and the author can concentrate on fleshing out the actions that serve the goal and the objects those actions require.

Goals can change during the game. In the Infocom game Lurking Horror, the player's goal initially is to get their homework done, but changes as the player finds out more about the situation. In this case, the initial goal will lead the player to a point at which he or she will stumble over a later goal (if the game is well constructed).

Goals can be specified in different ways. They can be set out explicitly (the tape recorder in Mission Impossible) or implicitly (the puzzling events in Lurking Horror that obviously need investigation). They are often clarified by means of rewards, such as points given for advancing toward the goal, or new areas to explore opening up. (Indeed, the achievement of a goal should be clearly recognized in the game, or it will feel anticlimactical.)