M.2 is just a socket type. It allows for very small SSDs vs the normal 2.5 inch SSD.
M.2 can however support 2 protocols. SATA which is the same as the normal 2.5 inch SSD, and PCIe. PCIe is faster and some computers have PCIe 2.0 x2 or x4 M.2 slots which will run the drive faster than SATA. But the real advantage is computers that have a PCIe 3.0 x4 M.2 slot that supports NVMe. That is a super fast protocol that offers some of the fastest drives you can buy right now.