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.
Arsenal have signed teenage midfielder Krystian Bielik from Legia Warsaw for a reported £2.4m.