When I use the Subdivision Surface modifier on a basic cylinder, it turns into a weird-shaped sphere
Two things;

Edge Crease

If you would like to tighten up the edges of a cylinder, you can look at the second and third meshes below;



The first one is unmodified (other than making it taller than a default cylinder, which is why yours is more of a sphere).

The second one was created by selecting the edges and using shift+e, which adjusts what blender calls the "edge crease".

The third adds two edge loops near the top and bottom (which can be added with ctrl+r)

Poor subdivisions and ngons

But what do we do about the odd tops? These are poorly subdivided because the top is a non-regular face (called an ngon, which is any face with more than 4 edges). The simplest fix for this is extruding the face, then merging all the faces into the center;

Extrude the face with e;



Right click to drop it back in place;



Then hit alt+m and select "At Center";





Roughly the same process can be applied to the edge loop version. You'll notice that the results are a lot cleaner in rendered view;





Note: I didn't fix the bottom of the cylinders in these examples