One popular answer to the question of how do we gain knowledge is that we do so through experiences and perceptions of the real world. If you burn yourself, you know fire is hot; if you look at grass, you know it’s green etc. Much of the scientific method is a refinement of these sorts of ideas. However, as with many aspects of philosophy, experiences can be misleading and perception is not as simple when you begin to think through the details of the process.
Knowledge through experience has the drawback of being highly specific to that particular situation whereas knowledge gained by the scientific methods strives to have universal applications. Equally, human experiences are prone to any number of biases; from the confirmation bias that makes you only notice the rowdy youths on the bus to reaffirm your suspicions that all youths are disruptive to the brain’s desire for causal links that might inspire a hockey players to religiously put their left skate on first after doing that once and scoring a spectacular goal that game. That is not to say experience-based knowledge is always wrong - the sum of our cultural a posteriori knowledge, as it is called, is vast and often useful, but one has to be aware of the potential for unreliability.
As for purely perceptual knowledge, it may seem strange initially to have any doubts that the grass is green but this is a valid question.
Naive realism (also known as direct realism or common sense realism) does not question this, taking everything we see, taste, smell, touch and hear at face value. However, a representative realist would take into account the fact that being ‘green’ is actually just the result of grass reflecting a certain wavelength of light which human eyes can pick up and interpret as green. This creates a divide between direct sensory knowledge, such as the weight or shape of a blade of grass, and the greenness, a secondary form of sensory knowledge that comes about as a result of an imperceptible property of the grass. John Locke was a main proponent of this idea; Berkeley on the other hand prefers to go a step further into idealism which posits that our experiences of things are the only reality we can be sure of. Thus, according to idealists, if you are in a room alone and close your eyes, the objects within it, no longer being perceived, cease to exist in any meaningful way.