Why is it sometimes we enter a room and forget what we are doing there ?
There are a couple reasons why a person may forget what they entered a room to do. This can be for a very simple reason, or it can be for a more complex reason.
First, for the simple reason. Many times, when one forgets what they are doing, is the result of not being focused upon the task at hand. This can be the result of the person thinking of too many things at one time and being distracted. Distraction does not allow information to be processed correctly (fails to embed). This failure to process what one needs results in them forgetting what they need to do.
Secondly, the information was not passed to the short-term memory area (or the working memory). The process of the short-term memory is explained below.
Short-term memory refers to memories which last for a few minutes. Unlike sensory memory, which is stored in the exact form it was experienced, short-term memory has received some processing; thus, "A" is stored not as a visual stimulus, but as an abstract concept of the letter "A". Short-term memory is of limited capacity, usually 5-9 items ("7-plus-or-minus-two"). Beyond this capacity, new information can "bump" out other items from short-term memory. This is one form of forgetting.
Essentially, this is another way to describe forgetting. Given that the information which can be stored in the short-term memory is limited (the short-term memory has a capacity), some information is replaced (or lost) as new information is brought in (which speaks to the first reason explained).