Is that not how modern trains work? Diesel of course.
Diesel Electric work very much like that. But they have enormous diesel engines. That generator probably cannot put out much more than 5 kW or slightly less than 7 HP. To drive a Tesla one mile takes about 0.22 kWH, so that generator might be able to just barely support an average speed of 5/.22 = 22.7 mph. (Assuming the generator could ride free.) Another way of putting it is that you would have to charge about one hour for every 23 miles you intend to drive. The advantage of electric motors is that they have very high low end torque, so they are superior to piston engines for starting a railroad train, not requiring elaborate gearing.