It is probably some organic contaminants in the new substrate. I have seen the foam you are talking about while washing raw sand before adding it to the tank. I just kept rinsing the new sand and it went away fairly quickly. The organics will get removed fairly quickly once you start doing water changes. In the meantime, if the foam layer bothers you, you can remove some by laying a paper towel on the water surface and lifting it off before it sinks into the tank water, in a more or less skimming fashion.