The light you see radiates in every direction from a light source and moves in a straight line. When something blocks the straight path of the light, it just stops because it can't go through or around that object.
Since light can't get to the area behind the object blocking it, a dark shadow appears.
You can change the shape and size of the shadow by moving the object that is blocking the light or by moving the source of the light.
Property of light makes it happen
Whenever light(and waves in general) reach an obstacle, they bounce off.
Shadows appear simply because, the light that was falling on that area or spot is being shielded.
We see shadows because, there is more light in the surroundings that than there is light at the shadow area.
That's why you cannot see a shadow in a dark room.
The way shadows are formed in such a way that the shape of the shadows resembles the object is because light travels in straight lines.
This means that, a light ray wouldn't just jump up the obstacle and land on the other side and then you would see some funny light spots on the shadow