Most major train routes would take you to Mannheim from where you can catch a regional train to Heidelberg which only takes approximately 15 minutes. once at Heidelberg's Hauptbahnhof (main station) the city centre is a manageable walk (approx 20 minutes) or an short tram ride away.
Showing major train routes and cities nearby Heidelberg. Enlarge this map of Germany Map Key
represents normal rail lines in Germany
represents fast rail lines in Germany