Tesla’s factory is designed to eventually make batteries and as many as 500,000 vehicles a year. It will give the EV maker a base in one of the world’s most competitive auto markets.