The oxygen atom's nucleus is composed of eight neutrons and eight protons. The protons that are present have a positive charge, which attracts the electrons within the water molecule and pulls them closer.
This way, the negative charge of the water molecule is concentrated around the oxygen atom, creating a partial negative charge. Meanwhile, the hydrogen atoms are left with a partial positive charge as electrons have moved away from them.