Because in order for a solution to conduct electricity, it must be an electrolyte - that is, it must contain free ions (charged particles). HCl, or hydrochloric acid, dissolves freely in water, with its ionic bonds releasing to create H+ and Cl- ions in solution. This happens because Hydrogen is able to release its electron, and Chlorine has a high affinity for electrons, so when the two of them join, the bond they create actually involves a tranfer of electrons from H to Cl; when this bond is broken the electrons stay with the Cl, creating ions. The presence of these ions allows electricity to flow through the solution, thus making it a conductor.
Glucose is not an ionic substance. The bonds that hold this molecule together are covalent, meaning that electrons are shared rather than transferred from one atom to another. This occurs because Carbon, which has 4 valence (outer shell) electrons, is able to hold onto its own electrons and share them with other atoms such as Oxygen. As a result of this sharing, when a glucose molecule dissolves, no ions are released. With no ions in solution, electricity is unable to pass through.
There are 2 types of basic compounds- ionic and covalent. Ionic bonds are formed when a metal gives up valence (outer level electron shell) electrons to a nonmetal. Covalent bonds form between 2 nonmetals (the same kind or different) and they SHARE valence electrons instead of exchanging them.
Hydrogen atoms only have 1 electron which means their outer most shell is their valence shell. This means that this electron is available for transfer in the case of an ionic bond and sharing in the case of a covalent bond. Hydrogen is one of a few pesky elements that can behave differently than the standard rules of the periodic table describe. It is due to its simple and small structure.
So, if hydrogen is in the vicinity of certain nonmetals its electron will be pulled away from it to make the valence shell of the nonmetal "happy" or filled to capacity. If, on the other hand it is in the vicinity of other nonmetals, it will share its electron and that nonmetal will share its outer electron with hydrogen making its 1 electron shell filled or "happy."
Electricity is the flow of electrons by definition so a source of electrons would be needed to get electricity to flow through an object. When HCl is dissolved in water the ionic bond is broken and free electrons (electrolytes or charged particles) or given off so electricity is allowed to flow.
If, on the other hand sugar (glucose) is placed in water, the covalent bonds are not broken so no source of electrons (electrolytes) are available for electrical flow.