The idea is that you shouldn't have to care what kind of shape you are dealing with. For example, if Shape defines an abstract draw() method, then Triangles, Squares and anything else that extends Shape will also have the same method.
A simple definition for polymorphism is "treating different types as if they are the same", i.e. using the same interface.
In an ideal world, we don't want to have to worry about what specific type of object we are dealing with, only the interface of a more general type that covers all usage scenarios in its interface.
Shape p1 = new Square();
Shape p2 = new Triangle();
p1.draw();
p2.draw();
In this code, we are directly calling Shape.draw() on p1 and p2. We don't care what the implementation class does, only what is defined by the interface (or abstract parent class).
Edit: Regarding the example in the question, It is generally recommended to avoid that kind of code pattern by encapsulating behaviour where possible. Using instanceof can be considered a code smell, as you would have to update all your conditionals whenever you add a new class.