What are greenhouse gases?
Any gas that allows short wave radiation to travel through it but blocks long wave radiation.
A greenhouse gas, like carbon dioxide or methane, allows visible light and shorter wave radiation to pass through it. In other words it is transparent to that type of energy.
When that shortwave energy hits the Earth it heats the Earth. The Earth then emits heats or infrared energy which is what we refer to as long wave radiation. Radiation of this wavelengths do not pass through greenhouse gases. The gases are not transparent to radiation of that form. As a result, like the windows of a greenhouse, greenhouse gases allow energy to enter but do not allow the heat generated by the energy to escape.