Shares of Rivian Automotive Inc. skyrocketed after hours Tuesday after Volkswagen AG said it will invest $1 billion in the electric-vehicle maker, with plans to pour billions more if an EV-focused joint venture between the two companies gets off the ground.