Function of water and the need of two barrels in a biogas Generator
The reasons are as follows:


The inverted barrel must be full of water. Then, when methane is formed, it will displace the water and the barrel will start floating. Methane does not do anything with water. It is almost insoluble (solubility is around 40 mg/L) and therefore does this setup work. 
The second tank is storage. Without storage you have to burn the methane when it is formed. With the second tank you can use it when you need it and you can a higher flow rate. 
If to much methane is produced and not consumed at the burner, it will come out of the second tank. But you can control that by stopping the feed in the first tank.