We study the hyperfine interaction between the nuclear spins and the electrons in a HgTe quantum well, which is the prime experimentally realized example of a two-dimensional topological insulator. The hyperfine interaction is a naturally present, internal source of broken time-reversal symmetry from the point of view of the electrons. The HgTe quantum well is described by the so-called Bernevig-Hughes-Zhang (BHZ) model. The basis states of the BHZ model are combinations of both S- and P-like symmetry states, which means that three kinds of hyperfine interactions play a role: (i) The Fermi contact interaction, (ii) the dipole-dipole like coupling and (iii) the electron orbital to nuclear-spin coupling. We provide benchmark results for the forms and magnitudes of these hyperfine interactions within the BHZ model, which give a good starting point for evaluating hyperfine interactions in any HgTe nanostructure. We apply our results to the helical edge states of a HgTe two-dimensional topological insulator and show how their total hyperfine interaction becomes anisotropic and dependent on the orientation of the sample edge within the plane. Moreover, for the helical edge states the hyperfine interactions due to the P-like states can dominate over the S-like contribution in certain circumstances.