Polyester is blended with cotton for a number of reasons related to the cost, performance, washability, and color-fastness (ability to hold dye) of the fabric.
Polyester can be cheaper than Cotton fibers, so it may be blended to make the fabric more affordable.
Polyester has "performance" qualities, like wicking and quick-dry properties, so may be added to make the cotton absorb sweat better. On the flip side, polyester is not breathable and cotton is, so by blending the two, you can get a fabric that is both breathable and sweat-resistant.
Polyester also doesn't shrink as much as cotton in the dryer, so it may be added to reduce shrinkage.
And in some instances polyester can help a fabric hold its color for longer, or increase the ease of screenprinting.
In short: Polyester is an efficient and utilitarian fiber, so it will often be added to fabric where affordability, durability, washability, and function are a priority. Mass-market apparel, activewear, and workwear all prioritize these elements.