Both sentences are correct -- but they mean slightly different things.
The first sentence means that we already know that Alisa's friend gave her an apple -- perhaps we mentioned it in a previous sentence, or even (in a book) a previous chapter. The listener -- or reader -- can be expected to know the identity of the apple. "Ah yes --" thinks the reader, "that apple, I remember."
The second sentence means that the apple hasn't been mentioned before. This is new information for us. "Oho --" thinks the reader, "so Alisa's friend gave her an apple, did she? I didn't know that before."
"Alisa's friend gave her an apple." (New information -- this is the first time that apple has been mentioned.)
"Oh really? And what is she doing with the apple?" (The speaker is referring to the apple mentioned by the first speaker. This is old information.)
"She's putting it on the table." (There is only one table in the room, so we automatically know exactly which table it is. So we use "the".)
"The" means: "You know which one I'm talking about."
- For Teachers