How are N95 masks different from dust masks?
The short answer to your question "What's the science behind the N95 filter?" is that it is what's called a tortuous path filter, removing particulates from a flow of contaminated air by impact and absorption of the particulate onto the filter material or by trapping particles of sufficient size between the fibers constituting the filter.  

The term N95 comes from the NIOSH (National Institute for Occupational Safety and Health, a body of the US government) rating where the 95 means that the material is certified to block 95% of particles 0.3 μm or larger in diameter. The limiting factor toward achieving the stated level of performance during usage is how well the mask seals to the face of the user. Whiskers, dirt and improper fit can all allow a larger portion of particles to circumvent the filter material. The image in the OP shows a mask having a valve to facilitate breathing and maintain a seal by opening during the exhale portion of a breath.