Electrons are shared unequally in covalent bonds due to the electronegativity of different atoms. These are called polar covalent bonds.
Because of this electronegativity, the electrons spend more time at one nucleus rather than the other, resulting in slightly negative and slightly positive charges to the atoms.
http://bioap.wikispaces.com/file/view/111_Electronegativity_Table.jpg/163806647/111_Electronegativity_Table.jpgElectronegativity is determined by a number of factors such as valence electrons, or atomic weight.
By looking at the electronegativity table, the atoms with a higher electronegativity will attract the most electrons, making that atom slightly negative. Fluorine, Oxygen and Nitrogen are the most electronegative atoms due to their small size and their valence electrons.
I'm not sure about why a hydrogen atom from hydrochloric acid would be attracted to water, but that's some basic info about unequal electron sharing.