In the given experiment, the water rises because
Oxygen is used up in the tube and the water rises to take up its place.
In the given experiment, phosphorus reacts with oxygen present in the test tube to form phosphorus pentoxide (P2O5). Again this phosphorus pentoxide reacts with water vapour present to form the phosphoric acid (H3PO4). Since all the oxygen is used up inside the test tube in the process, as a result, water rises up in the test tube.
The chemical reactions involved are as follows:
4P+5O2⟶2P2O5
P2O5+3H2O⟶2H3PO4