Bielik, 17, who underwent his medical at Arsenal last week, signed for Legia from their Polish rivals Lech Poznan in July and has made six appearances in all competitions this season.
Arsenal say the deal "is subject to the completion of regulatory processes".
The Poland Under-17 international can play in both a holding midfield role and at centre-back.
He said: "I've decided to move to Arsenal and although I cannot be sure of what's to come in the future, I'm going to London to fulfil my dreams.
"I'm grateful to my team-mates and manager Henning Berg for trusting such a young player and giving me a chance to play for the first team. It's mostly thanks to him that I'm able to move to Arsenal."
Berg said: "Krystian is a very talented player, who is going to achieve big success in football in the future."
For each position, select whether you think Arsenal are sorted, or if a player is needed.

Rangers say the defender slipped over during the squad get-together the day after Saturday's 2-0 win over Burnley.
The Sun claimed Caulker was injured after a fight broke out at a pub that Crystal Palace players were also at.
But QPR's head of communications Ian Taylor insisted: "Steven Caulker was not involved in an altercation."
Taylor added: "He suffered a cut to his head, which he received treatment for at hospital before being discharged the same evening."
Taylor also explained that players had been given permission to have Sunday lunch together given QPR's next game against Everton was not until Monday, 15 December.
QPR owner Tony Fernandes took to Twitter to comment on the claims.
"Steven Caulker slipped over and hurt his head and is fine," wrote Fernandes. "Nothing else to report."
Former Tottenham and Cardiff centre-back Caulker, who has one England cap, has made 15 appearances this season, scoring once.

The verdict came from the Care Quality Commission's first inspection since the University Hospitals of North Midlands NHS Trust was created in November.
The hospital was at the centre of a Â£6m public inquiry into care failings.
But despite the CQC's overall finding being critical, the trust said it was "highly complimentary" about the standard of care in some areas.
Inspectors visited County Hospital, formerly Stafford Hospital, and Royal Stoke University Hospital, also run by the trust, in April. They carried out unannounced inspections in May.
Mid Staffordshire NHS Foundation Trust, which ran Stafford, was dissolved in November after a report concluded it was not "clinically or financially sustainable".
700,000
People served by the hospital trust
194,954
Combined A&E visits to the two hospitals (2013-14)
1,508 Beds provided across the two sites
8,848 Equivalent full-time staff employed by the trust
The NHS in Staffordshire was given almost Â£300m to create the new trust and relocate some services in the county.
The CQC said it recognised "that the leadership of the new trust has had the significant task of bringing together two organisations at a challenging time. We have seen that progress has been made but there is still more to be achieved".
The trust was rated as good overall for how caring its services were, but told it required improvement to ensure safe, effective and well-led services. It received an inadequate rating in relation to whether services were responsive.
Several initiatives within children and young people's services at Stoke were rated as outstanding in relation to whether they were caring.
Outstanding work was also seen in the specialised neurological unit at County Hospital, inspectors said.
But the trust was told it must address high waiting times in its emergency department, and inspectors noted the Royal Stoke had "consistently and frequently failed the four-hour waiting time target".
It also said the trust should review capacity and adequacy of critical care services, and communication between senior management and frontline staff.
Mark Hackett, trust chief executive, said: "Less than a year ago there were serious concerns about the sustainability, and therefore the safety, of services at County Hospital, but the CQC has now given the hospital 23 good ratings and just one inadequate rating."
He said the trust was addressing the areas for improvement the CQC identified.
Arsenal have signed teenage midfielder Krystian Bielik from Legia Warsaw for a reported £2.4m.
[NEXT_CONCEPT]
QPR have denied Steven Caulker was involved in an altercation and say he was taken to hospital after cutting his head during a lunch with team-mates.
[NEXT_CONCEPT]
A new NHS trust set up to run Stafford's hospital requires improvement, inspectors have said.