Because if the leg is swelling then there is blood running to the swollen part because the blood wants to repair the injury so if you tilt it up higher than the heart it makes it harder to send blood to due to the incline of the leg
This will help to push blood/fluid back towards heart because circulation of blood from legs to heart is against gravitation. This is recommended for people with leg swelling.