SMS stands for Short Message Service. It’s a standard communication platform built for for early days of mobile communication, when texting someone meant flipping open your phone and trying to communicate with the buttons on the dial pad.
Messages were also capped in length at 160 characters (barely more than a tweet). That limitation remains in effect, though a modern text messaging apps will turn longer messages into an MMS (Multimedia messaging) in order to workaround that limitation. It's part of the GSM protocol and doesn't require a data connection. Instant messaging works differently. Messages are sent over the 'net and through the servers of whichever company runs the service. As such, you just need an Internet connection to communicate, whereas with SMS your device needs to be connected to a cellular network.