In a water molecule, the oxygen atom is more electronegative than the hydrogen atom, which means that it attracts electrons more strongly. This creates a slight positive charge on the hydrogen atoms and a slight negative charge on the oxygen atom, creating a polar molecule. When two water molecules come close to each other, the positive charge on the hydrogen atom of one molecule is attracted to the negative charge on the oxygen atom of the other molecule, forming a hydrogen bond.
Hydrogen bonds are important in water because they are responsible for the unique properties of water, such as its high surface tension and high specific heat capacity. They also play an important role in the structure and function of proteins, nucleic acids, and other biological molecules.