Deep learning algorithm has been trained on big photo database. So while image resizing it used knowledge about edges and corners that exists in the world. Thus algorithm generate image details and create illusion that image resized without losing quality.