I read once that good boxers play checkers, great ones play chess...
You are new to this, ive it time but never let your brain be inactive. Early on all those hands flying around can be a bit unsettling, as every time you get set to do something a glove bounces off your head and when you become aware of an opening it is gone before you can punch at it. When you get a lull you fire punches anywhere, not caring if they land but glad to have a chance to fire back. You can stay out of range and avoid his punches but you can't hit him either, and to go inside means getting hit, etc...
Practice is where it all begins and ends, doing the sae basic moves over and over until they are ingrained in your muscle memory, and at the same time you are training your mind. Start with shadow boxing, in front of a mirror. Imagine a real opponent throwing real punches, avoid them and counter them and do it full on like in the ring, with movement, bobbing weaving, punches slips and parries. You are not only able to see and correct your technical mistakes but you are teaching your boxing brain to evaluate and react to situations: " I want to stay outsidwe on his guy, use my jab, look to walk him into a right. He's looking to rop his right over my jab, if he can, burt he's really wanting to get close and work his left hook." Now you have an objective, an idea of traps along the way, and your opponent's goal and now you need to set to set taps for him, and so on.
This carries over o your bag work. If you just stand there and punch the heavy bag that's how you'll fight. You have to practice moving in and out, footwork, positioning yourself to land a paticular punch or combination, all the whil being aware of his intent o hit you. So you begin be slipping his jab, stepping in with a right under the heart, weave out wit a hook to the belly and straighten up to land a right hook over his left shoulder, and then you can step safley out of range or throw a hook, etc... The key thing is to always have a scenario in mind and to do it like its real.
Sparring as often as is possible is the most vital thing; spar daily, withany and everyone, just spar. At first you'll be dismayed at your inability to land a decent punch and at how often you get hit, but keep parring especially with people better tan you as you can learn by watching and cetainly by being on the defensiv for lengths of time against somebody that can throw combinations. Pretty soon you'll realize that half the hands in the air have nothing to do with you and can be ignored, and you won't have to think "catch this jab or parry it?", "block his hook or duck under?" because it will be second nature to you. It is now that you begin working on landing your punches, as you have no fear of moving into punching range as you can avoid or deflect or block the majority of punches. All the hours of envisioning couterpunches will pay off; you'll have trained your body to parry to the outside of the jab while hooking to the chin, for example.
Now you can really begin to strategize in the ring; hours in the mirror have taught you that a feint this way makes you look open for a right, so you can anticipate his reaction. Your bdy will be instinctively protecting itself and taking counterpunching opportunities, so your mind is free to think and to analyze.

For all my longwindedness, its just time and practice and training your mind like you train your body.