A company controlled by the founder of scandal-plagued Luckin Coffee Inc. agreed to sell its stake in Car Inc. to a unit of Beijing Automotive Group Co. Ltd. (BAIC Group), ending a month-long fight for ownership of China’s biggest car rental provider.