Electric/Driverless cars need operating systems. Apple has OS X. The only way Apple can make a car operating system is to make a car to test it. I would trust Apple's OS over anyone else's.
So while they may not be making a car for the public, they want to get their OS into as many cars as possible to control the ecosystem - just like they did with the iPod, Mac, iPhone and iPad.