How cool your clothing keeps you in the summer is a function of multiple variables, some of the relevant ones here being:
1) Insulation / airflow: Air circulation plays a key role in heat regulation, so even a slight breeze can keep you cool, if your clothing allows the air to move through it. Cotton, in general, is more breathable than polyester fabric, and hence superior for cooling in this regard.
However, breathability is not only based on the type of fibre used, but perhaps more importantly on the way it is twisted into yarns and woven into a fabric. Heavy tightly-woven fabric made from thick cotton yarns will prevent airflow much more than a sheer open-weave polyester netting, for example. But, for two comparable weights and weave types, cotton will be breezier.
2) Moisture absorption: with most cotton fabrics, as moisture (usually sweat) pools onto your body, it'll soak into the cotton fibres, and the garment will cling to your skin in the dampened areas (hence the reason wet t-shirt contests are possible). This is good for staying cool in the heat, since the moisture stays in contact with your skin, and can cool it via evaporation. The drawback is that you can look visibly sweaty through your clothing, especially if you are only wearing one layer (e.g. a shirt). A good summery cotton fabric will then let the evaporating moisture escape into the air freely.
Polyester fabric, on the other hand, tends to be either moisture trapping, or moisture wicking, neither of which are ideal for cooling in warm weather. A moisture trapping fabric will hold your sweat against your skin, but will not let the evaporating moisture escape easily. The result is a warm clammy garment that holds in your body heat.
More specialized moisture wicking fabrics are designed to quickly pull the sweat up away from your skin, to the outer layers of the fabric where the moisture will be held until it evaporates. This is good for keeping you looking and feeling dry, but it robs you of the cooling effect of your sweat evaporating against your hot skin.
On a related note, one of polyester's drawbacks is that it holds on to odors much more than cotton, potentially even through extensive washing; if you often find yourself sweating in a polyester garment, it may permanently take on your body odor over the long term.
So, cotton usually beats polyester for coolness. But, as hinted above, there are also countless ways that polyester can be processed and turned into different fabrics with vastly different properties; likewise with cotton. A sheer, open-weave white 100% polyester shirt will keep you cooler on a sunny day than a thick, black 100% cotton flannel.