When you start in photography, shoot anything and everything. Eventually, you will notice that you gravitate toward a type of subject. You may also notice that you take exceptional photographs of a specific subject. That will become your specialty. It is a good practice to specialize in an area of photography so that you can improve you skills and technique and become and expert in the field.
However, it is also essential to stretch your abilities into areas where you are not comfortable. By doing so, you will learn different techniques that you may be able to bring back to your preferred specialty.
Also, photographing something outside of your comfort zone helps reinvigorate your creativity. It helps spark ideas and makes you change your perspective.