That y-splitter is for having more than one device hooked up to another. For example, that person that you observed wants to be able to hook up his headphones to his PC's sound output or have the PC output its sound to his TV speakers, so the stereo y-splitter is used. What he probably does is unplug the splitter from the TV to use headphones only or unplug his headphones to use his TV speakers. With all hooked up at the same time, he will get sound out of both his headphones and TV.
This works because the two female jacks are simultaneously connected to the male plug. So all left channel connections are joined together, all right channel connections are joined together, and all grounds together, and there's no connection between left and right or ground and one of the others; otherwise, the sound will not come out properly.
A possible risk is for the fellow to have his PC sound maxxed out and not lowering the volume before plugging his headphones in. He may then hurt his ears with all that volume. The reason why he might max out his PC's sound volume is to rely on his TV instead for volume control.
Between a TV and a PC, either can be used to control the sound volume, but the PC alone controls volume for the headphones unless the headphones have their own volume control.