The position of Secretary of Defense is a tremendously important position that involves oversight of the entire Defense Department. The fact that a person once served as a non-commissioned officer in the US Army does not make that person qualified to hold that position. Thus, we should not assume that Hagel deserved to be confirmed simply because he had been a war hero in Vietnam.
Most of the attacks on Hagel came from the political right. They generally accused him of not being sufficiently aggressive and pro-military in his policy preferences. He was criticized for saying that the Defense Department should be reduced in size. He was strongly criticized for not being supportive enough of Israel and sufficiently antagonistic towards Iran. Conservatives disliked him for these reasons, though there was surely some degree of desire simply to oppose anyone President Obama proposed.
Hagel was also attacked from the left, though not nearly as vigorously given that he was being nominated by a Democrat. The main source of this criticism was that he was not supportive of gay rights. This is an important issue in the military right now with the recent ending of the “don’t ask, don’t tell” policy on gays in the military.
Thus, Hagel was opposed because of his policy positions. No nominee for a hugely important position like this should get an automatic confirmation simply because they are a war hero.