Taking a beginners class before you go to Germany would be a good idea, so you'll at least know some basics about pronunciation, grammar etc., German is pretty difficult, so the only way to learn it properly is talk, talk, talk. Books and CDs may support your learning but won't be sufficient.
The Goethe-Institut offers German classes, which are, AFAIK, pretty good, but very expensive (more than 1500€). The is a Goethe-Institut in Mannheim.
Another possibility is to take classes at a "Volkshochschule" (there are Volkshochschulen in both Mannheim and Heidelberg), they will start from about 150€.
As I mentioned, you'll only learn German if you're forced to use it daily. A good way to get in contact to young Germans is living in a shared apartement (Wohngemeinschaft, short "WG").
As Kathrin already wrote, living in Heidelberg is very expensive, a room in a "WG" can cost up to 400€ (usually between 300 and 350€), a single room apartement can easily cost 550€, that's why most students in Heidelberg live in Wohngemeinschaften.
I lived in Heidelberg for two years, and i didn't like it, it is a nice town, but that's about it. IMHO it was to small, to pricey and to many tourists. I'd prefer Mannheim, where you'll find a room in a Wohngemeinschaft for 200€, an apartement can easilybe found for 250 - 300€, even in prime locations, plus you'll find more shopping possibilities and a bigger cultural scene.