Why do men randomly put their hand in their pants when sleeping?

Noticed my boyfriend doing this and just find it kinda comical 😂😂 any thoughts?