Field of Dreams was a movie adaptation of the book Shoeless Joe by W. P. Kinsella. I won't spoil the plot here (be careful of clicking links though), but it included an appearance by the ghost of Shoeless Joe Jackson of the Black Sox scandal of 1919.
The Major League Baseball (MLB) game was held on a special-built field near the one used in the movie (which is preserved as a tourist attraction).
The Chicago White Sox were chosen because of the story's focus on Shoeless Joe Jackson, who played for the White Sox in 1919. In the story, the Chicago White Sox played the New York Yankees in an externalization of the protagonist's internal conflicts between the logic of his adult thinking and the emotion of his childhood (my interpretation).
Random observations
Stats site 538 listed the players in the film (including some who did not actually appear but may have been implied).
Archibald "Moonlight" Graham played for the New York Giants, who later moved to San Francisco.
Fictional author Terrence Mann dreamed of playing for the Brooklyn Dodgers, who later moved to Los Angeles. Brooklyn is part of New York City.
The New York Yankees have made the most appearances and wins in the World Series.
It might have been interesting to have had the game between the White Sox and either the Cincinnati Reds, the winner of the 1919 World Series, or the LA Dodgers, who (as the Brooklyn Robins) were the National League team from the 1920 World Series. The "Black Sox" players were banned from baseball starting in 1920. So those choices would have been the series as it should have been played in 1919 or the series that could have been in 1920. But neither of those was the direction that the story took.