The concept of "y" and "en" can be difficult to grasp at first, as both words are often used quite idiomatically, and can be translated in a number of different ways.
Y and en are adverbial pronouns. Like all pronouns, their purpose is to replace a noun. Y and en act like adverbs in a sentence, as they're used to describe verbs.
Y is usually used to replace "à," "chez," or "dans" + a noun in a sentence, and in these cases, would normally be translated as "there" in English. For example:
I'm going to the cinema. Hugo is also going (there). -> Je vais au cinéma. Hugo y va aussi.
Are you going to Xavier's house? Yes, I'm going (there). -> Allez-vous chez Xavier ? Oui, j'y vais.
Y can also replace "à + noun" when using a verb or expression that needs "à" as a preposition, so long as the noun isn’t a person. In this case, it can be translated in numerous different ways. For example:
Do you remember the story of little red riding hood? I was thinking about it this morning. -> Rappelez-vous l’histoire du petit chaperon rouge ? J’y pensais ce matin. (Penser à)
I sent Jacques an email yesterday. I hope he’ll reply (to it). -> J’ai envoyé un email à Jacques hier. J’espère qu’il y répondra. (Répondre à)
In some cases, you’ll find that you need to replace “à + noun” where the noun is a person. In this case, you use lui and not y (regardless of the gender of the person). For example:
I’m writing a letter to Chloé; I’m writing a letter to her. -> J’écris une lettre à Chloé. Je lui écris une lettre.
Note that in some of these examples, the English sentences make sense even if you don’t translate “y” (I’m going = I’m going there, I’m replying = I’m replying to it). However, “y” must be included in French (“je vais” and “je réponds” are incorrect, whereas “j’y vais” and “j’y réponds” are correct).
You’ll also see “y” used commonly in idiomatic expressions, such as “il y a” (there are) and “allez-y !” (let’s go!)
En has two distinct meanings in French. Here, I’m only going to be talking about its use as a pronoun. En is used in a very similar way to y, but instead of replacing “à + noun,” it replaces “de + noun.”
Firstly, en can be translated as “some,” “any,” or “one.”
Do you want coffee? No, I don’t want any. -> Voulez-vous du café ? Non, je n’en veux pas.
Do you have any cheese? Yes, I have some. -> Avez-vous du fromage ? Oui, j’en ai.
En is also used to translate “of them” and “of it.”
There are a lot of trees in the garden; there are a lot (of them). -> Il y a beaucoup d’arbres dans le jardin; il y en a beaucoup.
How many cats do you have? I have three (of them). -> Combien de chats as-tu ? J’en ai trois.
Finally, en can replace “de + noun” when using a verb or expression that needs “de” as a preposition. In this case, it can be translated in numerous different ways. For example:
Do you need a dictionary? Yes, I need one. -> Avez-vous besoin d’un dictionnaire ? Oui, j’en ai besoin. (Avoir besoin de)
What do you think about it? -> Qu’est-ce que vous en pensez ? (Penser de)
Thank you for that. -> Je vous en remercie. (Remercier de)
Note that, as with “y,” the English sentences will sometimes make sense even if you don’t translate the “en” (there are lots = there are lots of them, I have three = I have three of them). However, “en” must be included in the French (“il y a beaucoup” and “j’ai trois” are incorrect, whereas “il y en a beaucoup” and “j’en ai trois” are correct).
As a pronoun, en is used in expressions such as “va-t’en !” (go away!)