StackOverflow users are (should be) trying to create a collection of questions and answers that make it easy to find solutions to programming problems or that explain different on-topic aspects of programming.
Asking questions is one way of contributing to this. Anytime you are asking a question that has not already been asked, you are adding to this collection and therefore benefitting the community as a whole.