Why is a cell membrane selectively permeable?

it´s selectively permeable because some substances can pass across the membrane and others cannot, and it´s always trying to keep the proper amount of water and nutrients inside and outside the cell.