I noticed that wing trailing edges of new airliners like A220 (CSeries) are not completely sharp. Instead, they are blunt. I always thought that the sharper the better in subsonic flow. What is the advantage in having this aerodynamic refinement? Is it perhaps to reduce drag or noise?
Making a perfectly sharp trailing edge has two main limitations.
The first limitation is due to the manufacturing process: the trailing edge is where the structural panels of the upper and lower wing surface meet and you need some thickness in the panel to get a proper bond.
The other limitation is aerodynamic: from an aerodynamic point of view, what makes the trailing edge thick is not its physical geometry but the thickness of the boundary layer. Indeed, the "real" aerodynamic shape of an airfoil is the one given by the "sum" of its geometrical shape and the boundary layer's shape. The following picture, taken from this paper, nicely depicts the boundary layer thickness by the trailing edge:
For a jetliner, the boundary layer thickness can go from some 1 to 10% of the chord, depending on the flight conditions (speed, density, angle of attack, shock waves,...). For example, for a jetliner with about a 5 m chord, the boundary layer has a thickness of some tens of centimetres and this is the real aerodynamic trailing edge thickness. So, those couple of mm of the geometrical trailing edge do not matter that much.
Although @sophit's answer is basically correct, I'd look at things a little bit differently.
From a purely structural viewpoint, you'd really prefer that your aircraft was spherical. This minimizes the amount of skin material you need for a given volume, thus generally minimizing weight. It also minimizes or eliminates all sorts of structural difficulties--point loading, lever arms, stress risers, and so on.
From a purely aerodynamic viewpoint, you'd like the trailing edge of the wing to be absolutely razor sharp--something like a single atom thick would be your real ideal. But even if it's thin, material for a sharp trailing edge weighs more than material that simply isn't present.
So the question becomes one of overall design: where do you lose more from extra weight of material to get a sharp trailing edge, than you gain from a small improvement in aerodynamics?
To be honest, I'm pretty sure for quite a while most designers never really gave much thought to things like blunting the trailing edge. First you optimized an airfoil, then you figured out how to build that as efficiently as possible. There was work put into things like modifying the airfoil a little next to engine nacelles, as needed to meet structural requirements, and to deal with changes in airflow near the engines. But most of the design was done somewhat piecemeal: design and optimize one part, then design the next, and so on, until everything was done. But unless a really serious problem arose in a later stage, you did your best to avoid modifying work that was already done.
Now we have (among other things) enough more computer power available that it's relatively reasonable to devote extra time and effort to optimizing on a more holistic scale. So even after we decided on the basic airfoil shape, it's pretty easy to go back and compute weight savings vs. drag loss from having a sharper/blunter trailing edge, rather than treating the airfoil as 100% fixed, and just figuring out the most efficient way to fabricate it exactly as it was originally designed.