Dynamics and high-energy emission of the flaring HST-1 knot in the M 87 jet