I am new to blender, while making a cup i was doing an inward extrusion but it is not working. I was extruding the upper face of cylinder inwards to make it hollow like a cup but instead it's extruding a solid on the other side too instead of a cut.
It's not a bug. You extruded straight down, through the sides of your cup.
Blender isn't going to stop you from doing this, as it's not a real solid cup, just mathematical points connected in a conceptual 3d space.
I'm on mobile, so an illustration I sketched out in my notes app will have to do. Imagine this is the side profile of your cup. The green arrow is how you wanted to extrude, but the red arrow is how you actually extruded.
Luckily it's easy to fix. Your extrusion was not wrong - just incomplete. The other step you have to do is scale in the face that resulted from the extrusion. Then it won't be intersecting awkwardly in a way that results in a non-manifold mesh. You can tell faces are backfaces (think: inside-out) when they're shaded darkly like that in the viewport. It's the first sign that you may have done something you didn't mean to.
Here's an illustration of what the side profile will look like after you scale it in to fix it:
You will want most 3D meshes you make to form a volume. There are a few exceptions (like leaf texture planes), but usually you want the mesh to be closed and not self-intersecting. Imagine: If it couldn't exist as a balloon (air-tight), then it doesn't have a volume.
Let's explore this concept with more sloppy drawings, shall we? Shaded all in green is the side profile of a cup that has a volume. Below that is the side profile of a cup as yours currently is, with self-intersecting faces that cannot form a volume. Marked in red are regions where backfaces will show as a result of the self-intersection.
Is it starting to make more sense now?
Your cup's extusion down is doing what Blender thinks you want, but not what you think you want. Extrusion (the 'E' key) travels at a tangential angle away from the average normal created by the vertices in your selection. Thus, they will continue in this straight path as you stretch it out (via mouse or input of a number on the keyboard). The issue you're seeing is that it won't automatically assume you want your mesh to stay within the bounds of the "cup". Here's a quick solution:
Hope that helps!