The Securities and Exchange Commission is investigating Goldman Sachs over its E.S.G. investment funds — funds that invest in companies that say they are committed to environmental, social and governance principles, according to two people familiar with the matter.