That is how HDMI works, or even when you extend your screen. Only if you are swapping from say the main screen to the HDMI output, then it would play on the tv, and the computer speakers would shut off. If you are mirroring what you are seeing on the computer screen, it is just like extending your display, sound will play through the tv, because the computer sees that output as your main audio.
Extending is just adding more Real Estate to your desktop on the display, so that you can do Dual display. You need to dig into your video interface utility and audio interface utility, to figure out how to manipulate which is the primary audio, which is the secondary audio, for what you are doing.