Why does the lower rope knot come off as soon as it is pulled, while the upper rope knot gets tighter and tighter? Why does the lower rope knot come off as soon as it is pulled, while the upper rope knot gets tighter and tighter?
The two knots are similar, but one is pulling tighter and tighter, as if it is locked, while the other is opened as soon as it is pulled, as if the knot does not exist.

 A: Introduction
The upper knot in your image is a Reef Knot. The lower is a Thief Knot. The knots are identical except for the positions of the long and short ends of the ropes (aka the standing and working ends, or fixed and free ends) which are adjacent and diagonally opposite respectively. The loop of each rope is called the bight.

Two related knots are the Granny Knot and the Grief Knot.  These are also identical except for the positions of the fixed and free ends. Like the Reef Knot the Granny has the fixed ends adjacent, and like the Thief Knot the Grief has the fixed ends diagonally opposite.
(Aside on etymology : Granny is a slight on landsmen who unlike sailors might not know how to tie a proper Reef Knot. Grief is a combination of Granny and Thief rather than a description of the insecurity of the knot.)
The Granny Knot is almost as secure as the Reef Knot while the Grief Knot (aka What Knot) is even less secure than the Thief Knot; it slips apart "wish astonishing ease" and is sometimes used for a party trick.
Insecure knots can be made secure by strapping the free ends to the fixed ends of the same rope, eg by wrapping twine around to bind them together. This eliminates the mobile "free" ends which can no longer pass through the bight of the other rope. The Reef/Thief Knots are then essentially identical both topologically and mechanically. Same for the Granny/Grief Knots.
(Aside : In this locked arrangement the Grief Knot is also known as the Grass Bend.)
Possible Simple Mechanical Explanation?
In the diagrams each knot has 3 upper crossings and 3 lower crossings. Where the ropes cross they exert contact forces on each other - normal as well as tangential (friction) forces.
In the Thief and Grief Knots the fixed end is pulling against the free end (see upper part of each diagram). The normal force is able to pull the free end of one rope through the bight of the other with relative ease because there is little resistance. (This is not the case if the free ends have been strapped to the fixed ends.) There is little slippage of one rope against the other, and the normal force is not great so the tangential friction force is not great either and little work is done against friction.
The upper half of the knot is then unlocked. The ropes in the lower half can more easily slide past each other because the cause of the normal force (the tension in the upper half) has been removed.
Whereas in the Reef and Granny Knots the fixed ends are pulling against each other (see lower part of each diagram). These ends cannot be moved, so the normal force (and therefore also the tangential friction force) is high. The only way to make progress is for the ropes to slide against each other which is resisted by high friction forces.
The extra strength of the Reef/Thief Knot compared respectively with the Granny/Grief Knot might be explained by the fact that in the former pair each rope loops around both fixed and free ends of the other, pulling them together and increasing the tangential frictional force between them. This increases resistance against slippage because each rope must now slip against itself as well as against the other. It also increases tension throughout each rope which further increases friction between them.
Whereas in the latter pair each rope comes between and separates the fixed and free ends of the same rope, thus avoiding the additional source of friction.
Recent Research in the Mechanics of Knots
A group at MIT published a mechanical theory of knot strength in Science magazine early this year :
Topological mechanics of knots and tangles
Vishal P. Patil1, Joseph D. Sandt, Mathias Kolle, Jörn Dunkel
Science  03 Jan 2020:
Vol. 367, Issue 6473, pp. 71-75
Unfortunately this is hidden behind a paywall. From the Abstract :

Despite having been studied for centuries, the subtle interplay between topology and mechanics in elastic knots remains poorly understood. Here, we combined optomechanical experiments with theory and simulations to analyze knotted fibers that change their color under mechanical deformations. Exploiting an analogy with long-range ferromagnetic spin systems, we identified simple topological counting rules to predict the relative mechanical stability of knots and tangles, in agreement with simulations and experiments for commonly used climbing and sailing bends. Our results highlight the importance of twist and writhe in unknotting processes, providing guidance for the control of systems with complex entanglements.

A popular explanation on MIT news feed is given in
How strong is your knot? With help from spaghetti and color-changing fibers, a new mathematical model predicts a knot’s stability Jennifer Chu | MIT News Office January 2, 2020
which states :

Basically, a knot is stronger if it has more strand crossings, as well as more “twist fluctuations” — changes in the direction of rotation from one strand segment to another.
For instance, if a fiber segment is rotated to the left at one crossing and rotated to the right at a neighboring crossing as a knot is pulled tight, this creates a twist fluctuation and thus opposing friction, which adds stability to a knot. If, however, the segment is rotated in the same direction at two neighboring crossing, there is no twist fluctuation, and the strand is more likely to rotate and slip, producing a weaker knot.
... A knot can be made stronger if it has more “circulations,” which is defined as a region in a knot where two parallel strands loop against each other in opposite directions, like a circular flow.
... These simple counting rules explain why a reef knot is stronger than a granny knot. While the two are almost identical, the reef knot has a higher number of twist fluctuations, making it a more stable configuration.

Earlier research was reported in
Untangling the mechanics of knots : New model predicts the force required to tie simple knots, Jennifer Chu | MIT News Office, September 8, 2015
