When Zhang Fangming started learning Portuguese, it was with an eye to becoming a top Chinese diplomat in Brazil.

For Sun Jianglin, a Portuguese degree was about landing a job, but also a deeper knowledge of Brazilian music. “Bossa nova!” the 19-year-old undergraduate cooed. “I really like this kind-of-close-to-jazz music!”

The pair – who also go by the names Rodrigo and Antonia – are part of a new generation of Chinese students hoping a mastery of Latin America’s languages coupled with their country’s expanding role in the region will prove a recipe for success.

Twenty years ago – before a commodities boom made China Brazil’s top trading partner – ties between the two were negligible and few Chinese students studied Brazil’s official language, which has more than 220m native speakers worldwide. Today, record numbers are doing so, wagering it will guarantee them work as diplomats, interpreters or lawyers for Chinese ministries or firms in the Lusophone world.

“There’s a saying: ‘Learning Portuguese will help you find a good job, with good pay!’” said Sun, a second-year student at China’s leading language school, the Beijing Foreign Studies University (BFSU).

There has also been an explosion in the study of Spanish – spoken in many Latin American nations – with about 20,000 Chinese undergraduates in 2016 choosing the language, up from just 500 in 1999, according to official figures.

Margaret Myers, the head of the Inter-American Dialogue’s Asia and Latin America programme, said more and more Latin America departments were opening in China because of a Communist party push to foster regional experts.

“In the past five years we’ve seen … centres open all over the place, from Wuhan, to Tianjin, to Zhejiang – you name it,” said Myers, who wrote a recent report on the trend.

Many of China’s Portuguese graduates still end up in African countries such as Angola, Mozambique or Cape Verde, where Beijing has a well-established presence. But as Beijing’s Latin American footprint grows, they are increasingly looking further west.

Zhang Fangming and Sun Jianglin – or Rodrigo and Antonia – on campus at Beijing Foreign Studies University. Photograph: Tom Phillips/The Guardian

“Brazil is a country of possibilities,” said Zhang, from Zibo in Shandong province, who is halfway through a four-year degree at BFSU. Zhang, 20, admitted the 17,000km (10,600 miles) between Beijing and Brazil meant his knowledge of Latin America’s largest economy had yet to expand far beyond the cliches. He painted it as a resource-rich “melting pot of different races” and admitted most students knew only about its football.

Sun, from Handan, 440km south of Beijing, has also yet to visit but has been swotting up on Brazilian politics from afar.

“A lot of corruption, I have to say!” she said of the “Car Wash” scandal that has engulfed Brazil’s political elite. “I thought it was very funny how this big thing happened and the president had nothing to do with it!”

Brazilian culture left a better impression. “Every time I watch it, I will cry,” Sun said of her favourite film, Walter Salles’s Oscar-nominated Central Station.

After initially struggling with Portuguese phonetics she had also fallen in love with a language that showed her “a culture which is different from Chinese culture … more optimistic”.

If China’s growing sway in Latin America is a boon for students, for Washington it is a worry. Myers said the US had longstanding misgivings about Beijing’s motivations and now considered China one of three key regional concerns, alongside migration and the Venezuela crisis.

Fuelling those anxieties is the region’s possible inclusion in the Belt and Road initiative (BRI), a $1tn (£760bn) Chinese infrastructure spree critics say is partly a pretext to lure smaller countries into Beijing’s orbit.

US fretting intensified last month when El Salvador became the third Latin American nation in just over a year to switch its diplomatic allegiance from Taiwan to China – a decision the White House denounced as “of grave concern”.

Myers said Washington’s reaction reflected its fading regional clout: “Between the BRI and the Taiwan switches, China’s presence and influence is really alarming people in DC.”

Beijing has tried to soothe such fears. The Chinese foreign minister, Wang Yi, recently claimed China did not seek to “move anyone’s cheese” in Latin America. But while most experts describe Beijing’s Latin American interests as largely economic, some see a growing strategic military threat.

“The Chinese have not yet established bases in the region, as they have in Djibouti,” but their military connections were expanding, Evan Ellis, a US Army War College Latin America specialist, wrote recently. “Such knowledge would be valuable in the remote but not unthinkable eventuality that [China] seeks to operate from the region in the context of a serious military conflict with the United States,” Ellis warned.

Chinese Portuguese students have security concerns of a different kind. Sun plans to visit Brazil after graduating, but will stick to São Paulo, one of the safer corners of a country that suffered a record 63,880 homicides last year. “Other cities are a little bit dangerous for me.”

Zhang said a teacher recently told him of a friend whose Rio home was invaded by burglars while she was studying. According to Zhang’s account, the student asked her Brazilian assailant if she could finish her homework first.

“The robber was quite friendly actually,” he said. “But the final result was that he took her computer.”

Additional reporting by Wang Xueying