Once I asked this question from my teacher and he replied "Because it passes light.". "And why does it pass light?" I asked and he said, "Because it is transparent.".

The same question again, Why glass is transparent? Why does light pass through it, while for opaque objects, it does not?

Photons pass through glass because they are not absorbed. And they are not absorbed because there is nothing which "absorbs" light in visual frequencies in glass. You may have heard that ultraviolet photons are absorbed by glass, so glass is not transparent for them. Exactly the same happens with X-rays for which our body is nearly transparent whilst a metal plate absorbs it. This is experimental evidence.

Any photon has certain frequency - which for visible light is related to the colour of light, whilst for lower or upper frequencies in the electromagnetic spectrum it is simply a measure of the energy transported by photon. A material's absorption spectrum (which frequencies are absorbed and how much so) depends on the structure of the material at atomic scale. Absorption may be from atoms which absorb photons (remember - electrons go to upper energetic states by absorbing photons), from molecules, or from lattices.
There are important differences in these absorption possibilities:


Atoms absorb well-defined discrete frequencies. Usually single atoms absorb only a few frequencies - it depends on the energetic spectrum of its electrons. Regarding atomic absorption, the graph of absorption (plotted as a function of frequency of light) contains well-defined peaks for frequencies when absorption occurs, and no absorption at all between them.
Molecules absorb discrete frequencies but there are many more absorption lines because even a simple molecule has many more energetic levels than any atom. So molecules absorb much more light.
Crystalline lattices may absorb not only discrete frequencies but also continuous bands of frequencies, mainly because of discrepancies in the crystalline structure.


As glass is a non-crystalline, overcooled fluid, consisting of molecules, its absorption occurs in the 1st and 2nd ways, but because of the matter it is composed of, it absorbs outside our visible spectrum.
