Are you utilizing higher gears?
Usually, problems like this are not with the bike, but with the engine. But that doesn't mean your "out of shape" it simply means the others passing you are in better shape, perhaps been cycling longer. Or simply have naturally better legs for cycling, so you have to work harder than they do.
If you want to improve speed, make sure you're keeping hydrated, make sure you're taking in protein right after the ride.
You have a relatively short amount of time post work out to make use of protien, in a perfect world, you'd hop off the bike and plow down a protein shake and then go cool off and relax for a while.
Secondly, give yourself recovery time. I've noticed that when I've been really hammering it all week, riding a lot, and doing all the other things I do, I slow down the longer i go without a day of rest. When you're stronger, you'll need a lot more of a work out to effect this, but starting out, you'll want to give your body rest. and Nutrition.
A lot of things can effect your speed, Aerodynamics, quality of moving parts (drivetrain, wheels), Rider fitness, weather, hydration/nutrition.
Rider fitness and hydration nutrition are the best to focus on because it will effect you in all aspects of life, and it won't matter what cycle your on.