Those are very general questions.
1. Stocks move due to many different reasons - earnings announcements, company events, market news etc. It is all based on demand and supply for that stock.
2. People do not buy and sell according to the S&P500. Generally, stock moves with the market, but...