There are many reasons as to why you are getting bad gas mileage. Some of these problems barely effect you, but some of these can really lead to poor gas mileage.
Cars have an optimal speed, which happens to also be right around most speed limits. That speed is 55 miles per hour. Going faster will cause your engine to work harder and more gas will be used. It is more fuel efficient to drive near the speed limit.
Traffic causes stop and go driving. This basically means you are constantly accelerating, and then braking back to zero. A lot of gas is used when you have to get the car into motion. Doing this over and over is the reason why city gas mileage is much lower than highway mileage on almost all car models.
Parts of your car can affect your fuel economy. Your tires may not be inflated properly to the right pressures, which could make you lose as much as 3 to 5% of your gas mileage. Another problem could be your air filters, which may be clogged. This can be dragging you down as much as 20%.
If you constantly drive with your A/C on, it could be leading to lower gas mileage. The A/C drains your car of power, and uses gas to work. If you can, drive with your windows cracked to get some air, or even all the way up.
Idling is when you have the engine on, but your car is not in motion. Idling is a waste of gas, and you can lose a small percentage of your gas while not even going anywhere.