Yes, two days is enough for Hanoi if you plan your itinerary well. There is a lot to do in Vietnam's capital city, but most of the museums and attractions are located close together. While Hanoi isn't a very walkable city, you can use Grab, hire a motorbike, book a tour and walk if you really wanted to visit Hanoi's attractions by walking.