There are two rail connections from Karnataka to Kerala.
The first is via Mangalore. The Second route is via Bangalore and Coimbatore ( Tamilnadu)
Below is a table with a few popular train example. There are many more trains that connects Kerala with Karnataka cities.
[table]
Route | Major Cities/Towns in Karnataka Major | Cities/Towns in Kerala | Example Trains
Bengaluru to Ernakulam | Bengaluru | Ernakulam (Cochin) | KSR Bengaluru Ernakulam SF Express (22607/22608), Kochuveli Express (16315/16316)
Mangalore to Thiruvananthapuram | Mangalore | Thiruvananthapuram (Trivandrum) | Parasuram Express (16649/16650), Maveli Express (16603/16604)
Mangalore to Ernakulam | Mangalore | Ernakulam (Cochin) | Poorna Express (11097/11098), Parasuram Express (16649/16650), Maveli Express (16603/16604)
Yesvantpur to Palakkad | Yesvantpur (Yesvantpur) | Palakkad | YesvantpurâKochuveli Garib Rath Express (12257/12258)
Bengaluru to Kannur | Bengaluru | Kannur | Kannur Express (16517/16518)
[/table]

Coorg

Train routes to Kerala from Bangalore