Why do my handlebars wobble left and right?
Different bikes can have different geometry. The head tube (the tube that continues the line of the front forks up to the handlebars) angle has a big effect on how the bike handles.

A steeper head tube makes the bike more "twitchy". You can feel like you're all over the place. A bike like this would be a more serious road bike, and if you are used to using flat handlebars then it probably has narrower handle bars (drop bars) also.

Both of those make it harder to control, until you get used to it.
So my advice is: keep trying, it will get easier.

For more reading see


Frame geometry
Explaining the effects of frame geometries
Geometry of bike handling
What effect does head tube angle have on a bicycle?