How does Nick know Daisy and Tom?
As the answer above indicates, Nick knew Tom when they were in college together at Yale, and he identifies Daisy as his second cousin, once removed. Shortly after the war (World War I), he says, he had spent two days with them in Chicago.
While Nick both explains that he comes from money and discounts his own wealth against Tom's "enormous" wealth and his "string of polo ponies," and while Nick also discounts his relationship with this couple as one with people he hasn't seen in years, it is clear they all come from the same social set. Tom includes Nick as a fellow "Nordic" without any hesitation and consistently approaches him with an insider bonhomie. Tom, on the other hand, looks through lower caste (to his mind) people like Gatsby as if they don't exist.
Further, chapter one makes it clear that Tom and Daisy are informed about what is going on in Nick's life, insisting they have heard he is engaged. He denies the engagement, but their knowledge of his doings, whether right or wrong, again reinforces the idea that they run in similar circles.
Nick knows Daisy because they are sort of related. They are cousins. To be more specific, they are second cousins once removed. Nick knew Tom when they were both in college together at Yale. They also spent some time together in Chicago right after the end of World War I, but he had already known them from before.
You can find the answer to this question in Chapter 1. This is very early on where Nick goes over to see Daisy in East Egg and meets Jordan Baker for the first time.