A Sandbox game is a game that the player has the ability to alter their environment in some substantial matter, hence the term sandbox.
The term sandbox is in reference to a child's Sandbox in which you can alter the landscape and build shapes. Not to be confused with the term Open World, where the player may roam openly through the world, without artificial gimmicks to direct a set path. The story driven aspect has no effect on whether a game is sandbox or not, but can sway if a game is open-world.
Many sandbox games are open world, as they usually go hand in hand and compliment eachother well, examples would be Minecraft, or Trove. Examples of games that are sandbox but not open world would be along the lines of Robocraft. Example of games that are open-world but not a sandbox would be, Cubeworld, or Ultima I: The First Age of Darkness.