Oxygen is more electronegative than Hydrogen
So . . .
When the two form covalent bonds, oxygen pulls the electrons closer and farther from hydrogen
So . . .
The water molecule is polar, with oxygen more negative and hydrogen more positive.
So . . .
Since opposites attract, the more negative oxygens attract the more positive hydrogens of other water molecules, forming the hydrogen bonds.