When we "enter" a fictional world, we imagine that we are there. The question therefore is: How can we imagine an experience? To answer this question, you have to understand how our perception of reality works.
When we perceive the world, we are not in direct contact with the world, but rather removed two steps: the physcial objects that (probably) surround us reflect light, cause sound, send out molecules and so on, and our sensory organs register these light particles, changes in air density, molecules (smell) etc. Our sensory organs then send signals to our brain, and our brains try to make sense of these signals by comparing them to information already stored in our memories. That information itself, of course, is only stored sensory input and the sense we gave it, so that in essence our knowledge of the world is like trying to decipher a text in an unfamiliar script: by observing regularities and repetition, i.e. a non-random structure, can we deduce the meaning that this text (or the world) has in relation to us. So in effect the "real" outside world, as we experience it through our bodies and in our minds, is an image.
Here is a graphic illustrating this idea (Velmans, 2008):
When we feel sad, because something sad happens in our lives, we do not actually experience any of the things that go on around us. What we experience is the image our mind creates from the sensory input. Our bodies may live in the outside phyisical reality, but our Self, as we are conscious of it, lives in a mental image of that outside world.
This image of the world is being induced in our minds by the sensory input. But there are experiences that feel totally "real", although they lack sensory input or are caused by input that does not resemble them, for example when we dream or when we halluciante. People who hallucinate cannot tell if what they "see" is real or imagined.
When you watch a movie, read a book or daydream, you know of course that you are merely reading or watching a movie or daydreaming, but you suspend that knowledge and allow the image that you create from that limited input to take up a large part of your thoughts. And like the image of the real world, this image created from text or moving pictures will of course trigger emotions. This image will be "weaker", somewhat "transparent" (in the sense that you can still see the real world through it), so the emotions it causes are weaker.
The basis of the influence of media on you is your motivation. If you watch a movie with a critical eye, refusing to forget that what you see are paid actors that will take a shower and go home after shooting that scene, no image will form in your mind, you won't "enter" that fictional world, and you will feel nothing special, except maybe a numb back from sitting in the cinema for two hours. But if you want to go to that wondrous place and allow your imagination to be transported there, then your imagination will use the movie or book to create an image that cannot but affect you.
The model of perception given above is the one most commonly held to be accurate by scientists and philosophers today. Max Velmans, from whose article I used an image to illustrate that model of perception, believes a different model, that of reflexive monism, "most closely follows the contours of ordinary experience, the findings of science, and common sense". Read the article linked to below, if you are interested in his views.
I believe that this answer does not need any sources beyond the quoted image. All of the above follows logically from how our perception works, which, as it is taught in school, can be regarded as common knowledge.