The top 5 in the S&P 500 are 4 tech companies and JP Morgan Chase. The top 5 by market cap are all tech companies.
The market cap of a company is largely based on a bet of the “size” of a company in the future.
Tesla is the most “valuable” US auto maker, by market capitalization. This illustrates that market cap is inherently related to predictions which have a large speculative component, which can be influenced by pure market phenomena.