Hydrogen adsorption on the WO3 (001) surface has been studied by performing DFT calculations with the B3LYP functional and periodic slab models. We show that in the case of WO3 (001) surface the common practice to fix the bottom layers of the oxide slab results in spurious surface states and in the incorrect description of the band structure. The problem can be removed by full relaxation of all of the slab layers, resulting in converged values of the surface energy (0.33 J/m2) and of the band gap (2.75 eV vs computed bulk value of 3.10 eV). When H is adsorbed on the surface, we find that the under-coordinated O or the surface in-plane O1,p,y sites have about the same binding energy, 2.5 eV. We find comparable adsorption energies also for one subsurface in-plane O site (O2,p,y), which suggests an easy migration of the H atom on the surface or into the bulk. In all cases, H binds to the O anions as a proton and donates the valence electron to the 5d level of one or more W ions (formal change of oxidation state from W6+ to W5+). The corresponding occupied W 5d states lie high in the gap and sometimes even merge with the conduction band. The more or less localized nature of the donated electron depends on the site where the proton is bound, suggesting a high mobility of the excess electrons. Dissociative adsorption of H2 is a weakly exothermic process at low H coverage but becomes weakly endothermic at high coverage. The partial modification and occupation of W 5d states, by hydrogen adsorption on the surface or introduction in the lattice of WO3, can explain the experimentally observed change in optical and electric properties of this material when exposed to H2 gas, also known as the "chemichromic" effect because of the analogies with the well-known "electrochromic" effect.