Why is glass transparent?
Because the energy of visible light does not match any gap that the electrons in glass can jump across, so the light passes through without being absorbed.
In any material, electrons occupy fixed energy levels. A photon can be absorbed only if its energy exactly matches the gap between an occupied level and an available empty one. If no such gap matches, the photon cannot be absorbed and continues through.
In glass — largely silicon dioxide — that gap is large. Absorbing a photon would require considerably more energy than visible light carries. Visible photons therefore pass through untouched, and glass appears transparent.
Ultraviolet light carries more energy, and much of it does match the gap. This is why ordinary window glass blocks a substantial part of UV, and why you do not get sunburnt through a closed window despite the room being bright.
Metals sit at the opposite extreme. Their electrons are free to move and can absorb almost any energy, so light is absorbed and immediately re-emitted at the surface — which is reflection, and why metals are shiny and opaque.
A second factor matters: structural uniformity. Even a material that does not absorb light will appear cloudy if it scatters it at internal boundaries. Glass cools from a melt into a disordered but uniform structure with no crystal boundaries, so there is nothing to scatter light. This is why crushed glass looks white — you have created millions of surfaces — and why ice is clear while snow is white, despite being the same substance.
Adding impurities changes both properties, which is how coloured and tinted glass is made.