If I am not mistaken this is a dragonfly nymph. I photographed it at Hoyles Mill Park last Saturday. It was in the creek clinging to the side of a rock with its posterior end in the water.
Were the immediate ancestors of insects aquatic or terrestrial? The most commonly accepted answer seems to be that insects descended from terrestrial ancestors that themselves had evolved from marine ancestors. But when one considers the groups like the order Odonata (dragonflies and damselflies), where the majority of the species have aquatic juveniles, one may tend to think that this is an evidence in support of the opposite route of insect evolution: from the sea to land via estuaries and freshwaters. Gullan & Cranston (2005), however, offer one counter argument:
Another line of evidence against an aquatic origin for the earliest insects is the difficulty in envisaging how a tracheal system could have evolved in water. In an aerial environment, simple invagination of external respiratory surfaces and subsequent internal elaboration could have given rise to a tracheal system...that later served as a preadaptation for tracheal gas exchange in the gills of aquatic insects.
Gullan, P.J & Cranston, P.S. (2005). The Insects. 3rd ed. Blackwell.