An oxygen atom has 6 electrons in which two of them are bonded with a hydrogen atom leaving two lone pairs of electrons. Due to the presence of these lone pairs of electrons in H2O, the bond angle is 104.50. This can be explained with the help of valence shell electron pair repulsion theory (VSEPR).
VSEPR Theory is used to predict the shape of the molecules from the electron pairs that surround the central atoms of the molecule. According to VSEPR theory atoms will always tend to arrange themselves in a manner in which this electron pair repulsion is minimalized. This arrangement of the atom determines the geometry of the resulting molecule.