There are two separate voices with different timings written on the same staff. One voice plays the notes with stems pointing up, and another plays the notes with stems pointing down. What the voices mean depends on the type of music and instrumentation. In a band, they may be completely separate instruments, but an organist or pianist can play many voices simultaneously.
The bass staff has a third voice.
Think of this bit of music as three instruments. One plays the notes in the lower stave. One plays the stem up notes in the upper stave, one the stems down notes.
Keyboard music will not always be laid out as clearly as this!