Cuban President Fidel Castro arrived today for a two-day meeting with President Jose Lopez Portillo apparently designed as a display of solidarity between Mexico and Cuba, which was not included in last week's North-South talks iin Mexico.

Lopez Portillo warmly embraced the Cuban leader as he climbed from his yacht onto the quay of this resort island.The two men talked amiably as they strode past line of soldiers, drenched in smoke from the gun salutes that startled the tourists snorkeling nearby.

The two president, who have met twice before, then had lunch and their first orund of talks. the surpirse visit, announced only last night, is clearly low-key and both sides have brought only small delegations.

There was no formal agenda, although it was announced that "topics of mutual interst" would be discussed. These almost certainly include a Mexican briefing on last week's session of 22 foreign min;isters in nearby Cancun to prepare a summit meeting of rich and poor nations to be held in Mexico in October.

Cuba had lobbied intensely to participate, arguing that Castro had a right to be present as the chairman of the Movement of Nonaligned Nations, which consists largly of developing countries. As the host of the summit and a friend of Castro, Lopez Portillo reportedly supported Cuba's participation. But Castro was not invited, as it became clear that his attendance would almost certainly keep President Reagan away.

Yet Mexico does not want relations with Cuba to be affected, which led to this gesture of inviting Castro for a separate but early visit. Mexican press reports said Castro had been miffed and Cuban Foreign Minister Isidoro Malmierca had suggested openly at a meeting of foreign ministers of developing nations in New York that the organizers of the summit had buckled under to American pressure.

Lopez Portillo and Castro also are expected to talk about conflicts in Central America, according to Mexican government sources. Both men have stronly criticized U.S. support for El Salvador's right-wing military in that country's civil war and have chided the Reagan administration for pressuring Nicaragua's revolutionary government.

Castro called on Lopez Portillo on this same resort island off the Yucatan Peninsula two years ago and lat Ear the Mexican president went to Havanna. Since then the two men seemingly have developed a strong personal rapport and ofte praise each other publicly.

There was little commotion here as Castro's naval yacht steamed into the green Caribbean water off Cozumel Island, but his arrival by a small boat surprised press and politicians who came to observe the visit. The vessel is about the size of the Granman, the yacht with which Castro and a group of revolutionaries took off from the Mexican coast 25 years ago and set out to fight the dictatorship of Fulgencio Batista.