DETROIT — General Motors on Wednesday said it plans to spend $20 billion on electric and autonomous vehicle programs in the next five years and expects its battery costs to fall below the level that analysts say would make EVs competitive with internal-combustion vehicles.