Enlarge this pic and you can make out most of the details. Basically, There is an inner and outer hull -picture a tube inside a tube. The space between the two can be flooded with water to make the ship sink. The amount of water in this space (called the ballast tanks), either makes the ship lighter, neutrally buoyant, or heavier than sea water allowing it to dive. Also, there are fins called "dive plains" that help to steer the ship up or down when submerged. There is also the rudder, which acts the same as a conventional ships rudder- controlling left and right movement. Compressed air is used to force the sea water out of the ballast tanks when they want to surface.
The inner hull, called the "pressure hull", is where the crew operates. It is much smaller than the actual outside diameter of the ship because of the space taken up by the ballast tanks. It is also the wall that must withstand the pressure of the sea water trying to crush it in. In the front (called the bow), you can see the torpedo room, where 1 to 4 torpedo tubes were located. To fire a torpedo, the torpedo crew would load one into the tube, then shut a water-tight hatch on the back end of the tube. Then the tube would be flooded with water and compressed air, pressurizing it. When the captain had the ship in firing position, he would radio the torpedo crew telling them to fire. They would then throw a lever opening the outer tube hatch, releasing the pressure and shooting the torpedo out. It then was powered by its own electric engine turning a small propeller.
Most WWII German u-boats used a combination of diesel and electric engines for propulsion. Diesel for surface power and electric for submerged. Contrary to what is usually depicted in movies, the u-boat was primarily a surface vessel; it only dived when it was stalking its prey. It could cruise faster surfaced, and use conventional navigation techniques. However, when an enemy ship was spotted, they would dive and use the electric motor. This was for two reasons- they did not have access to air for the diesel to consume, and the electric motor was very quiet, making it harder for surface ships' sonar to hear them. Unfortunately, the electric motors used a ton of juice so they couldn't do it for long. They were forced to eventually surface to run the diesel, which charged the batteries.
Besides for the propulsion, armament, and dive components they were just like any other ship. They had a kitchen (galley), bathroom (head), sleeping area (berths), control room (conning tower), fuel tanks, fresh water storage, armory, etc.