Actually scratch that. How did every loving single game company get their hands on it? I don't ever remember DooM being open source.
You know, I'm not exactly sure, but it might simply be that some smart minds over at 3D Realms figured out how it worked or backward engineered it and modified it enough to avoid any sort of lawsuit, OR they had a deal with id. In any case, I can't find any evidence of legal disputes or anything actually connecting the two games, but I'd most likely go with my first point up there about the minds at 3D Realms.
Also DOOM has almost always been open source, in a way. The WAD file format for DOOM allowed for easy modding and a modular system.