The role of the Federal Reserve is to help the U.S. economy operate effectively.
The Fed has a lot of power to influence the economy, and this indirectly impacts how stocks move. While the stock market is not the economy, it can be seen as a reflection of how confident consumers are about the strength of the economy now and in the future.