How do you know what build to use for an enemy?

I've been relatively new to the game but there's one thing i'm really struggling with. My main is Garen but I also play Olaf, Cho Gath, Tristana, Yasuo, Riven. Sometimes I see people go like this: I'm toplane Garen, my enemy is Yasuo, so I buy this and this and this. And when I'm against Teemo I have to buy this and this and this. But how on earth do I know what to build against my enemy? I really have no clue lol. I usually just use one and the same build because I don't know anything else.
Report as:
Offensive Spam Harassment Incorrect Board