Even frying an egg can produce carbon dioxide. It's easy really. When you burn natural gas at home for cooking or heating a lot of this invisible gas is produced as well as the heat energy. Carbon dioxide does not even smell. Ask your teacher to show you that burning a candle produces carbon dioxide gas.
Electricity is a bit more complicated.
Carbon dioxide is made when coal is burnt at a power station - this is where electricity is generated. The heat is used to turn water into steam, which drives giant turbines. This photo shows Drakelow Power Station in South Derbyshire which burns fossil fuels to generate electricity. You can see the large amount of steam which is released from the chimneys. These turbines power the generators.