You are purchasing your first house, congratulations, now you need some insurance.
Home insurance is in play to protect the bank and their investment in your and your home. They are allowing you to borrow money for this purpose therefore requiring you to have insurance in the case of a total loss.
Now who pays the insurance company? The answer is not a simple one or the other. Most of the time the home is escrow pay, or mortgage pay, this is because if the mortgage company pays the insurance company, they know that the policy will not lapse for non-pay.
I hear you person in the back, yes you can also pay the insurance company and bypass the middleman. This is not a normal process unless the home is close to being paid off and the bank would not be with a huge loss if there was a total loss.