Building out a new production line for vehicles is insanely expensive. Billions upon billions of dollars. You need the old cars to sell well enough to pay for this and all of your other expenses.
China got to get into the EV space with a mostly-clean slate. Their domestic manufacturers made absolutely horrid products at the turn of the century. They did what they do best: copy successful people with investment from the successful people.
They only let Western manufacturers sell in China with the cooperation of a local vehicle manufacturer. That necessitated a bunch of investment and IP transfers to Chinese manufacturers who didn't have to shell out themselves, and when they did, it was with the complete backing of the state.
When EV technology really became something viable in the last 10-15 years, they just used that capacity, lower wages, and lax environmental regulations around mining, to undercut the rest of the world on EVs.
It's easy to act like the rest of the world just isn't competent enough, but there are layers to this.