BMW will take on Tesla’s popular Model 3 starting next year with its first mass-market full-electric midsize sedan.