A philosophy of teaching is exactly like pohnpei397 explains. It is the map you follow when teaching your students. As a middle school, high school, prison system, and college teacher over my career, I would like to give you some examples that would explain further for a beginning teacher. The key part for you of pohnpei's answer is the very last sentence which says that a teaching philosophy "allows teachers to know where they are trying to go and how they plan to get there." As a beginning teacher, I had no true idea what that really meant in practical terms. To be specific, let's say that you are an English teacher who has to teach eighth graders how to write complex sentences when they are now writing in only simple and compound sentences. Your philosophy tells you to take them from where they are, in simple and compound sentences, and figure out a plan to get them to write complex sentences and why they want to learn this as it makes their writing more grown up. Let's say your plan has to include something for visual learners, physical learners, readers etc. For physical and visual learners, you can put two students in the front of the room (choose carefully), have them stand separately to demonstrate the I in one independent clause. Then have them hold hands to demonstrate the conjunction which holds compound sentences together or break the hand hold to demonstrate that they are still independent sentences. Then, have them hold hands, but push on the knee of one of them to show the students that without the one independent sentence to lean on, the dependent clause with the bent knee would fall as it needs the support of the independent clause. You will need to clarify coordinating and subordinating conjunctions. Give them a rhyme to memorize the coordinating as the subordinating list is too long. Construct several as a class to show them the patterns D,I or ID so that they understand the flexibility of complex. Then put them in groups to construct one complex sentence together and present it to the class. The class can then decide if it is correct or not. Make them vote individually after 2 or 3 so that you can see who does not understand. Then have them write three sentences of their own to trade among their small group. Have them choose the best sentence in their groups and present again, but to the next group. Then in each assignment after this, require one complex sentence which they must underline and label D,I or ID. For those who need a reference sheet, provide one which shows sentence patterns. Now, can you see that you need a map and a plan for how to teach students every one of the goals you have for them? You need to use your philosophy of teaching as to how to treat students, how to teach every kind of learner, the plan to teach the objective you have, and to make students use the information you have taught them so that you know you have reached your goal. I hope this helps you understand more completely with the examples provided.
I assume that you are asking why it is important for a teacher to have a teaching philosophy. I do not think that you are asking about philosophy in general as I have never heard it argued that all teachers need to know Kant, Plato, and Bentham. I will therefore discuss the importance of a teaching philosophy.
A teaching philosophy is important for the same reason that a map is important when you are going to try to travel to some place that you have never been. When you go traveling, you need the map to inform your movements. Without the map, you really do not know where you are trying to go. Your movements will tend to be rather random since you will just be moving around blindly, hoping to find your destination.
Without a teaching philosophy, your teaching actions will be just as random as the movements of the traveler who has no map. In fact, they may even be worse. If you have no teaching philosophy, you do not really know what you are trying to get your students to learn. In other words, you do not really have a destination in mind. Moreover, if you have no teaching philosophy, you will not have any idea as to how you want to achieve your goals.
A teaching philosophy establishes what sorts of things you want your students to learn. It then goes on to describe how you would want to teach them those things. By doing these things, it allows teachers to know where they are trying to go and how they plan to get there.