Elon Musk has a new friend in China.

Tech and gaming giant Tencent (TCEHY) just ponied up $1.8 billion for a 5% stake in Tesla (TSLA).

Led by its media shy CEO, "Pony" Ma Huateng, Tencent is huge. It has a market value of more than $275 billion, eclipsing that of Chinese e-commerce giant Alibaba (BABA).

Tencent owns messaging app WeChat, which boasts 889 million active users and is used for texting, paying bills, gaming and even booking karaoke sessions.

Tencent is also China's largest video game developer and publisher, holding a big piece of the global market. It acquired Finnish company Supercell last year, the maker of popular mobile games Clash of Clans and Clash Royale. Tencent's online game revenues topped $10 billion in 2016.

Related: Tesla looks to raise $1.15 billion as it preps for Model 3

So what's a company known for games and messaging apps doing investing in a popular electric vehicle start up?

Tech companies always want to get in on the next big thing. Right now, that means artificial intelligence and the so-called internet of things, which will play huge roles in the development of driverless and connected cars.

"The gaming industry is really advanced in terms of artificial intelligence," said Kitty Fok, a Beijing-based analyst with research firm IDC.

"Having Tencent invest in Tesla can help it integrate artificial intelligence and behavior," she said.

Connected cars will be the next big innovation in the auto industry, said Ka Leong Lo, an auto analyst at Maybank.

In the near future, "there will be many connections between vehicles, infrastructure and people," Lo said. "This is why Tencent is interested in Tesla."

Related: Intel buys Israeli self-driving car firm for $15 billion

The Chinese tech giant is also seeking a bigger global presence.

"There are a lot more people in the United States who know Alibaba," said Fok. Tencent's investment in Tesla "is good for their global brand."

This isn't Tencent's first bet on a big U.S. tech name. It quietly invested in Snapchat (SNAP) years ago, according to TechCrunch. Snapchat co-founder Evan Spiegel has even praised Tencent as a role model.

Tencent didn't say much about the thinking behind its Tesla investment.

"We share Tesla's vision in creating a better future for the planet," tweeted Tencent President Martin Lau, saying the Chinese company was "looking forward to working together as a supportive shareholder."