It only applies to Hamburg residents. Note that you are still required to observe all other Hamburg regulations concerning dogs; mainly: keep your dog on a leash outside of designated dog zones (it’s possible and common to get an exemption, but it requires you to pass a test and pay a fee - not something that’s worth it or feasible for only a week), and pick up after your dog.
No, it also applies to residents only. Enjoy your stay in Hamburg, it’s a great city for a visit especially with dogs!