Part of the impetus to invade the North and target Philadelphia came from the campaign being waged by LTG Ulysses S Grant on Vicksburg. His strategic objective was to split the CSA by seizing control of the entire Mississippi River. Only the stretch from Vicksburg to Port Hudson remained in Rebel hands.
CSA Pres. Davis wanted Lee to send a portion of his Army of Northern Virginian – probably the Corps led by LTG Longstreet – to re-enforce Vicksburg. It was seemingly Lee’s reluctance and resistance to this idea that led him to concoct the hare-brained and fatal (in hind-sight) scheme to invade the North. Remember, too, that this was his second attempt; the first being thwarted at Antietam. His assurances were that he could bring the war to an end if not via a massive military victory then by political pressure being brought to bear on Lincoln when the CSA defeated a Union Army on its own territory. So confident was Lee that he was going to march his men hundreds of miles into the North, via Harrisburg, and launch an attack on Philadelphia. His desired objective would have been Baltimore and indirectly WASH DC, but he thought them too heavily defended to attempt a direct attack. Philadelphia would have to do.
This then was the geo-political-military situation and strategy that led the CSA to its ultimate demise by 4 July 1863 when the Union was victorious at both Gettysburg and Vicksburg. Although the war dragged on for two more years, historians generally agree that it was on that date that the CSA lost the war; even though they may not all agree on which of those two victories was the pivotal one!