I've been to both, Hoi An more than Hue. My preference is Hue. Hoi An has become very touristic. Yes, it has some interesting sights. I like a cooking class given by Red Bridge very much. But you are surrounded by masses of people from around the world as you move thru the historic center. You can tick off what is to be seen in a few hours.
Hue is a true city with a wide range of historic sites surrounding it. Be aware there is heavy rain during part of the year so check the weather maps first. I think we were there in early December when we had monsoonal rain. But there are a vast array of cultural sights surrounding the city to be seen in better weather. We took a food tour one evening that was terrific and introduced us to local foods unknown to us. We want to return to Hue and spend several days visiting sites we have yet to see.