Companies for the S&P 500 are selected based on market capitalization, liquidity, and sector representation, while the Nasdaq 100 includes large non-financial companies, particularly those in sectors like semiconductors, AI, and other tech domains, marking them as 'good stocks' in their specific industries.