Chemistry - Why does like dissolve like?

The reason behind this is the hydrophobic effect. Everyone has seen it if they pour a spoonful of vegetable oil into a pot of water, e.g. to cook pasta. As long as nothing is disturbing the vegetable oil, it will collect itself together in one big bubble rather than form many small bubbles.

Polar solvents will always be arranged in a way that positively polarised areas are close to negatively polarised areas in the neighbouring solvent molecule. Hydrogen bonds — especially in water — are nothing but the extension of this concept to even more polarisation. Polar molecules, as you stated, will fit together with this scheme well. Unpolar compounds mixed in do not. As soon as you add an unpolar compound to a polar solvent, you are creating a type of artificial boundary and only the areas of the solvent molecules that are neither particularly positive or negative will be happy to be in the near vicinity. That means that you have a much higher ordering of the solvent molecules where they hit an unpolar compound, because one direction is basically doomed to be neither positive nor negative.

This ‘solvent wall’ will form no matter whether the unpolar island is large or small. However, it will also have almost the same thickness, no matter how big the contained part is. Therefore, if multiple unpolar molecules clump together, the overall number of polar molecules constrained in that wall is lower — an entropic gain. Thus, unpolar compounds tend to either not dissolve or precipitate out of polar solvent solutions.

This also works in the opposite direction. A polar molecule will prefer, for energetic reasons, to have a polar neighbour. However, an unpolar solvent cannot provide that polar environment. A neighbouring undissolved polar molecule, however, can. Here again, the polar compounds rather stay clustered together as it allows the central molecules to be more disordered while only a small layer on the border must take care to interact as well as possible with the unpolar solvent.

Note that this answer assumes some kind of black/white dichotomy. In reality, most compounds are somewhere on a scale from absolutely unpolar to very polar and are able to adapt to a wide range of organic solvents. Conversely, some organic solvents have the reputation of dissolving almost anything organic; most notably dichloromethane. However, the solubilities may greatly vary.