Elon Musk agreed Saturday to step down as chairman of Tesla and pay a $20 million fine in a deal to settle charges brought this week by the Securities and Exchange Commission.