With 1.7 million inhabitants, Hamburg is a big city, but it still not feels like that.
If you like to walk one to two kilometres, most attractions are within walking distance.
Otherwise, of course, public transport is well constructed and easy to use.
The best is to buy a day pass and go how much you want with the “S-Bahn” “U-Bahn” and buses.
Many hotels offer a free pass during your stay with them.
For tickets, prices and more information, see the local traffic site at hvv.de