I see on Google Maps a train track between the United States and Mexico via San Ysidro:
Does any passenger train go between the United States and Mexico via San Ysidro?
Travel Stack Exchange is a question and answer site for road warriors and seasoned travelers. It only takes a minute to sign up.Sign up to join this community
These appear to be the tracks of the Baja California Railroad. According to Wikipedia, it offers freight service only; there is no indication of passenger facilities of any kind. Moreover, it only runs as far as Tecate, where it connects back to a railroad on the US side. It does not connect to any other railroad in Mexico.
The San Diego Trolley serves San Ysidro and you can walk across the border from its terminus. The trolley can connect you to the US rail network via Santa Fe Depot, from which there is Amtrak service to Los Angeles and onward connections. But I do not think there is any passenger rail service to actually take you into Mexico.
Tijuana is isolated from the rest of the Mexican rail system.
That railroad actually loops back into the United States to make the very difficult crossing of the Peninsular Ranges of mountains. (which is why there isn't a crossing on the Mexican side). It was built by US interests to serve San Diego.
The Mexicans handle freight on their side, but it all comes via the Los Angeles area. Activity on the east end has been minimal and is mostly a heritage railroad operation.
The freight track from San Diego to San Ysidro is shared by the San Diego Trolley, which will take you directly to the border crossing.
No passenger trains towards the US via San Ysidro according to https://www.bts.gov/browse-statistical-products-and-data/border-crossing-data/border-crossingentry-data, which provides some detailed statistics on border crossing to the United States:
The Bureau of Transportation Statistics (BTS) Border Crossing Data provide summary statistics for inbound crossings at the U.S.-Canada and the U.S.-Mexico border at the port level. Data are available for trucks, trains, containers, buses, personal vehicles, passengers, and pedestrians. Border crossing data are collected at ports of entry by U.S. Customs and Border Protection (CBP). The data reflect the number of vehicles, containers, passengers or pedestrians entering the United States. CBP does not collect comparable data on outbound crossings
Looking at their database, one can select trai passenger and see how many individuals entered the US every year by train for each port of entry in the US since 1996:
It's 0 individual entering the US by train yearly via San Ysidro. It's more than 0 for a few other ports of entry: