Pilot's discretion. Some guys are all about saving fuel and don't like to start the APU at the gate until 10 minutes prior to push. Others have the cockpit window's open and frankly don't realize that it's sweltering in the cabin because the cockpit is getting a breeze. Speak up next time. Ask the flight attendants to talk to the pilots or better yet, pop into the cockpit if you're at the gate and ask them to crank up the APU and get some A/C going because its too hot in the cabin.