Understanding of re-entry heating at the time led to that decision. Around the time that Mercury was being designed, there was a huge problem in the field of ballistic missile design (which had a sister problem in the field of spacecraft design): at hypersonic speeds the noses of ballistic missiles would melt. The original thinking at the time was that the same shape that made it so easy to launch out of the atmosphere also made it so hard to re-enter the atmosphere. So a counter-intuitive design of a blunt re-entry body with a pointed nose for launch was considered (I'm aware that this doesn't address the question yet, bear with me!). See here for the development of that idea.
OK, but that's the back of the spacecraft. What about the top, which is what you're interested in? Why was it cylindrical instead of conical? It had to do with how the heat distributed itself across the capsule's body during re-entry. Cones were proposed by some contractors (see below), and initially the conical shape was experimented with. Page 95 of this document briefly talks about this.
The understanding at the time of how to keep the spacecraft cool, given all of the other constraints it was under, led to the choice of cylinder. Below is an image showing how various parts of the spacecraft heated up during entry.

The difference between the Mercury and Apollo spacecraft was a ratio of diameter to height. Below are images showing the various proposed designs. Notice how tall a Mercury capsule would have to be if it were conical, relative to its diameter.
