You probably saw the news articles in September reporting that China may lay out a timeline for automakers to end sales of fossil fuel vehicles, possibly by 2030 or 2040. This follows an announcement by the United Kingdom in July that it will ban sales of diesel and gasoline fueled cars by 2040, as well as similar pronouncements by other governments in Europe.
Why is this happening now? There are most likely several contributing factors, including the individual nations commitments to the Paris accord on climate change, strategic and political desires to reduce reliance on oil, and belief that the technology is available to facilitate the change. In the case of China, there are some additional driving forces such as the need to reduce serious pollution problems, as well as the desire (expressed in their Made in China 2025 strategy) to become self-sufficient in certain critical technologies and industries, including electric cars.