Hong Kong (CNN Business) Tesla is accusing a former employee of stealing intellectual property worth hundreds of millions of dollars and sharing it with a Chinese rival.

The electric car maker filed a lawsuit in the United States on Thursday, alleging that engineer Guangzhi Cao stole key details from Tesla's self-driving car project and took them to Xiaopeng Motors, a Chinese electric vehicle startup. Elon Musk's company is seeking damages and to stop Cao from using the information.

Tesla TSLA Apple AAPL says Cao uploaded complete copies of the company's self-driving source code to his personaliCloud account. He took more than 300,000 files and directories, according to a complaint filed in US District Court in California.

After accepting a job with Xiaopeng, Cao then deleted 120,000 files from his work computer and disconnected his iCloud account from it, the complaint says. He then repeatedly logged into Tesla's networks and cleared his browser history before leaving Tesla in early January.

Cao now works at XMotors, Xiaopeng's US subsidiary.

Read More