Oh, here we go.
That was General Buford, the first highest-ranking officer on the Union side to get to Gettysburg and realize how important the high ground was going to be there. He did what he could to prevent the Confederate forces to get that high ground first, and thanks to the arrival of General Reynolds' division they were able to deny the Confederates the hills on the eastern side of the battlefield.
On the Confederate side, General Longstreet realized exactly how bad the terrain was and argued against General Lee fighting for it, suggesting instead a flanking move towards DC to force General Meade to come off those hills. But Lee still wasn't sure where the entirety of the Union army was - his cavalry scouts under Jeb Stuart failed to report back, sowing confusion - and he wanted to fight, needing a victory on Union soil to convince Europe to recognize the Confederacy at last or else force the North to parley for a truce.
For the Union army, they were battered on that First day but held the high ground, giving them the advantage for the Second day...