The reason for this happening is because of cohesion and adhesion.
Meniscus is the curve of the upper surface in any liquid. It can be convex with is the curving outward or bulge outward. Concave is just the opposite
Cohesion is the ability of water molecules to cling to each other because of hydrogen bonds.
Adhesion is the ability of water to cling to other polar surfaces, a result of water's polarity.
So when water is placed into a glass container surface tension attracts the water molecules to the sides of the glass and becausee adhesion overcomes the forces of cohesion the water climbs the glass slightly.
The reason this does not happen with Mercury because the opposite of water happens the forces of cohesion are stringer than its attraction to the glass, it's aadhesion. It have the opposite effect meaning it will be concave.
Meniscus is a curve in the surface of a molecular substance and is produced in response to the surface of the container or another object. It can be either concave or convex. (please refer to the attached image)
Formation of meniscus depends on cohesive and adhesive forces in a liquid. For water, adhesive forces are stronger than the cohesive forces, therefore, water in a container stick to the wall of container and owing to the capillary action rises a little bit and form concave meniscus.
On the other hand, for mercury cohesive forces are stronger as compared to adhesive forces. Therefore, due to the capillary action the mercury falls down from the sides attached to the wall of the container and a convex or upward meniscus is obtained.