They are both made with yeast (Saccharomyces cerevisiae) - a living organism that produces ethyl alcohol and carbon dioxide when allowed to grow in suitable conditions. This is an example of anaerobic respiration, or fermentation, which produces a small amount of energy (ATP) compared to aerobic respiration. An animation of the process of ATP production during fermentation is here.
In bread making, the carbon dioxide gas is captured in a gluten matrix produced by working the flour together with water into a dough. When the dough is baked, the yeast is killed, the small amount of alcohol evaporates and the carbon dioxide produces a light, fluffy loaf of bread. More about the science of bread making here.
When making beer, sugar is added to ‘feed’ the yeast and carbon dioxide bubbles are produced, along with a small amount of alcohol (less than 0.5% in the bottle we will produce). The lemon juice and ginger added to homemade ginger beer is for taste.