My son did this. It was more convenient for him to pee in a bottle than to get up to go to the toilet. How disgusting. I have read here about other adult children who did the same. Rather than getting up from video games, and walk down the hall, they peed in cups and bottles.
I used to work in a casino, well over 30 years ago, and I remember a grown, middle aged man playing poker at a table saying this horribly gross thing to me, which I have never forgot. He said: Go and pee for me. Obviously he meant it as a joke. But there was a kernel of truth in it. He did not care if he degraded me and he was expressing the same wish as your grandson, perhaps, that he just can't be bothered to take care of a necessary bodily function, and sought a work around.
Of course there may be more serious reasons that underly this behavior, and it would make good sense to seek out the help of experts.