its all about the socket.
From Asus
Briefly known as NGFF (next generation form factor after mSATA), M.2 is the current connector standard for mobile SSDs, although it has also been adopted by motherboards as well. M.2 connector can plug in both PCI-Express-based and SATA-based SSDs, but is generally PCI-Express-based only. This is important because, as we explained above, SATA and PCI-Express protocols are not inter-compatible. The only way to confirm compatibility between your motherboard M.2 slot and your M.2 SSD is to read the respective product specifications first: if they match PCI-Express-to-PCI-Express or SATA-to-SATA, you’re good to go!