There is really no bad season to visit Hanoi. The city offers countless attractions that can be seen year-round, and the climate is generally agreeable.
Tourist season runs from late June through August and October through Tet, the New Year's celebration that takes place in late January or early February. Though accommodations and transportation are bound to be booked around Tet, it's worth making the effort to see Hanoi dressed up for the festivities.
Vietnamese tend to travel in the summer and around Tet, making public transportation that much more difficult to book.
Source: Lonely Planet