You are describing the structure of the cell membrane. It has two layers, consisting of hydrophobic (water repelling) tails, oriented towards each other, and hydrophilic (water loving) heads, arranged toward the inside and outside. This structure allows some molecules to freely diffuse across the membrane; these would be those that are hydrophobic, and include small, uncharged molecules such as oxygen and carbon dioxide.
Other molecules do not pass freely through, and instead only move through with an expenditure of energy by the cell; this limits their access to the cell. These types of molecules are polar; that is, they have areas of positive and negative charge, and include amino acids, nucleic acids, carbohydrates, proteins, and other ions.
Besides giving a cell shape and strength, the cell membrane is differentially permeable, allowing some materials to pass through while preventing others from doing so. With regard to molecules, the cell membrane is very permeable to water, certain lipid-soluble substances, amino acids, and sugars, but relatively impermeable to large molecules such as proteins and polysaccharides.