Some law enforcement agencies use compact shotguns for breaching - that is, shooting hinges and locks off doors for expedient entry. Although this has the unfortunate effect of making the gun a gangster's weapon fit mostly for assassins or poachers and therefore carry many legal restrictions for civilian users. So taking all that into account, the sawed-off shotgun isn't completely impractical. Adding onto that, sawing off the barrel and stock makes it easier to carry around, transport and hide by cutting down how much gun there is and how much weight it's packing it's like the difference between trying to drive home with a single bag of groceries in your trunk versus a length of wood that reaches from the back of the front seat to several inches past the rear bumper, in that both technically fit, but one is a lot easier to get in or out of the trunk and the other is going to require a conscious effort to keep from bumping it against things while you're driving. However in close quarters, the abilities to hide the gun until the last possible second and place it on-target without the barrel getting caught up on a close-in object like a wall are valuable. However, the biggest problem with sawed-off shotguns is when the stock is cut down to a pistol grip, making the weapon either extremely hard to aim, or, if aimed properly, extremely likely to recoil straight into the shooter's teeth. However, shotgun ammunition, particularly pellets, lose velocity rapidly enough that this doesn't really matter.
note Strictly speaking, longer barrels do somewhat increase muzzle velocity because the propellant has that much longer to "push" the projectile. Modern powders lose extremely little velocity even when the barrel is cut down to a foot long. Until the advent of high quality smokeless gunpowder, longer barrels on shotguns allowed for more velocity, and a sawed-off shotgun would have reduced power because of the reduced velocity. Shortening the barrel has different effects depending on the era. Contrary to popular belief, shortening the barrel of a shotgun has little effect on the spread of the shot - the spread is actually purposely limited with a 'choke' inside the very tip of the barrel, so you'll get basically the same change whether you saw off 2 inches or 20 inches. In real life, sawed-off shotguns aren't very practical. Its popularity easily eclipses all guns aside from the most famous, like the Desert Eagle. It's also easy to make - all you need is a regular shotgun and a hacksaw, it seems. In popular media, the sawed-off shotgun combines the power of a shotgun with the profile of a large handgun.