Consider magnesium supplements. You can get magnesium in a variety of forms: magnesium oxide, magnesium citrate, magnesium taurate, magnesium glycinate.
Each one of those formulas is going to contain magnesium, but the magnesium is bound to another molecule. One form of magnesium maybe be more effective than another for any given individual or condition. Some products are labeled as just "Magnesium" and it's unclear what form the magnesium is in.
Then there's a consideration of yield and purity. If you're making a compound through a given process, it's going to yield X amount of the desired compound, and Y amount of something else (other compounds or unconverted materials). Some of this is going to make it into the end product.
If two companies are using totally different processes to create the same end compound, everything is going to be different.
> I think labeling a generic incorrectly would result in pretty heavy fines.
Who's watching? I don't recall hearing much about generic manufacturers of prescription medications facing much scrutiny.