Without getting heavily into the legality of everything, Fox and Marvel Studios were both able to legally use the Scarlet Witch and Quicksilver, as both characters were originally mutant villains in the X-Men comics that turned into heroes on the Avengers roster. Sharing is good, yes?
Well, not in this case. Comic fans know that Wanda and Pietro Maximoff are the Jewish-Romani children of the X-Men villain Magneto. Since Marvel Studios couldn't reference mutants or the X-Men characters in their films at the time, they had to create new lore for the twins. New, problematic lore.
There was a reason that Wanda and Pietro being Jewish was brought up in the previous paragraph. The team at Marvel decided to have the characters introduced as superpowered agents of Hydra, the previously mentioned Nazi group that's "Totally not Nazis; that was just a phase, I swear you guys. We're an inclusive brand of evil now."
Instead of literally doing anything else, the decision was to erase Wanda and Pietro's Jewish-Romani heritage and make them from Sokovia, a country that doesn't even exist. That explains why the nation's main export is on-again, off-again Eastern European accents. Oh, and they further rewrote their origin by having them volunteer for Hydra experiments to give them superpowers.
So instead of keeping the characters' original background, a background shared by a very ostracized, prejudiced, victimized, and struggling minority that could use positive representation on the big screen, and finding any other way to introduce the characters to the movies, Marvel decided to just make someplace up so their Not-Nazis can create them as ubermensch-- er, superpowered soldiers.
They could have just been Jewish-Romani kids that stumbled upon an Infinity Stone. Or got powers from a lost super-soldier formula attempt that they discovered. Or literally anything other than alluding to the real-life experimentation of Jewish people by Nazis. For some reason, that was Marvel Studios' final solu--er, narrative problem solver.