McClellan actually did okay on the peninsular if you look at it the right way, his casualties were a lot lower than the Confederate's.
That had a lot more to do with McClellan's subordinates, than McClellan.
Mechanicsville, June 26th - Porter faced attacks from Longstreet, AP Hill, and DH Hill. They were supposed to be backed by Jackson, but were not. Porter repulsed them, inflicting heavy casualties on the Confederates. McClellan provided no reinforcements to Porter and ordered him to withdraw.
Gaine's Mill, June 27th - This time Longstreet, AP Hill, and DH Hill were supported by Jackson, leading to perhaps the largest Confederate attack of the war. Porter received minimal support from McClellan, and that late in the day Union troops withdraw across the Chickahominy, burning the bridges behind them.
On the other flank, Magruder’s reconnaissance in force is stopped cold by Hancock and driven off by a vigorous counterattack.
McClellan held a strong defensive position. He knew three more army corps were being sent to reinforce him. Several of his subordinates want to attack Magruder’s forces.
McClellan left the army, after ordering a retreat. He designated no second in command. He did not leave direction for Corps movement during the withdrawal. He did not appoint a commander of the rear guard.
He abandoned his army.
In spite of that, they not only survived, they inflicted heavy damage on the Confederates.