I felt it was obvious how he figured out. No one really gave Yui the time of day or cared much about her. Then here comes Otonashi and Hinata saw probably at least two full days of batting practice. He was probably eavesdropping when Otonashi asked the "What else do you want to do" question. That probably gave it away.