Well, "a" is an indefinite article and "the" is a definite article.
Let's say you are with a friend. You are hungry. If you say, "I want a banana.", it means you want a banana, ANY banana, doesn't matter which one. But if you say, "I want the banana.", I assume you guys were talking about a banana before and now you want THAT banana.
If you are introducing something in your conversation for the first time, you use "a" or "an". But when you bring up the subject again, when the people engaged in the conversation know WHICH thing you are talking about, you use "the".
Another example. "There is a bag on the table." Means there is just a random bag on the table. You most likely don't know whose it is, why it's there, nothing. "There is the bag on the table. " Here, it sounds as though maybe you guys were looking for someone's bag and you found it. Maybe it's the earlier situation. You didn't know whose bag it was so you went to someone else. You bring that person in to show the bag. Now you say, "Hey, see! There is the bag on the table, the one that I was telling you about. I wonder whose it is."
These a, an, the are always a trouble to non native speakers. But it will get easier the more you read texts and see them. So do not worry about it too much. But be very vigilant and notice them when you come across one. Good luck! :)