The pellet of dry ice is sublimating in air. The piece in the glass of water creates more fog because there's more contact with the water and carbon dioxide and because water has such a high heat capacity.