Basically, there were a ton of different Earths back in the 60s with DC. One had the Justice League, the other had the Justice Society. In one, Batman was married to Selina, in another he was single, etc. Back in the 1980s, DC had a huge event called Crisis on Infinite Earths that combined all the Earths of the DCU into one major Earth. Characters died, events were eliminated, etc. I never read the story, and don't intend to, but that's the long and the short of it.
Elseworlds is a now-defunct imprint of DC that told stories that could have happened - but didn't. For instance: Superman crash landing on Apokalips instead of Earth, or in Gotham City instead of Kansas, or Batman solving crimes alongside Harry Houdini.