Excessive aft CG
It has to do with stall recovery. If the CG is too far back, then if the plane stalls the nose will simply not come down. The upshot is that you can never regain airspeed and you will enter into what's called a deep stall or leaf stall.
One common reason for cargo aircraft crashes is improperly secured loads which shift backwards immediately after rotation on takeoff. There is a famous video a few years back of a US military cargo jet struggling to recover after departing a Middle East airbase. All aboard died, and I won't post the link out of sensitivity.
Excessive forward CG
If it's too far forward then your elevator will have to produce a ton of downward force to keep the nose up. This is draggy and inefficient. But it's also (within the limits of reason) survivable.
So where to put the CG?
As far back as you safely can! Competition glider pilots move the CG to the very limits of safety because they want to stop the elevator from producing downward thrust which costs precious meters of altitude.
Jetliners want an aft CG because it saves fuel. But don't panic, they have strict limits on how far back they can move it. Because in equal parts no pilot wants to die and no amount of saved jet fuel ever covers the cost of a crashed plane.