Lawrence of Arabia is a story about a man entering a world he doesn't understand, gaining the respect of its people, and learning to become like them. Lawrence doesn't really fit into any society -- he's as uncomfortable dealing with the British as he is alien among the Arabs. There's also a magical, heady quality to his depiction in the film. He's constantly surprising the people around him, knocking them off balance, and earning their praise and respect. He's an outsider who swoops into a problem and solves it with his wits and bizarre perspectives. Intelligence and inhuman endurance are two of Lawrence's great assets. He suffers great indignity, his value to history and to society is overlooked or lost, and he responds by nurturing a heightened opinion of his own importance.
I'm guessing that David empathizes with Lawrence and imagines or aspires to have Lawrence's positive qualities. He's intelligent and enduring in the way that Lawrence is. He's an outsider who can never really be accepted by his society. And, like Lawrence, he's arguably better than all the people who consider themselves superior to him: he's smarter, more resilient, and unafraid of death. He's constantly being put down by everyone he interacts with, and because of this "second-class-citizen" status, he probably imagines that his contributions to the mission are being tragically overlooked in the same way that Lawrence's legacy dwindled away. Like Lawrence, one of his greatest wishes is to have his magnificence recognized.
Most intriguing is David's soft, rhythmic repetition of Lawrence's famous line of advice: "The trick, William Potter, is not minding that it hurts." I think David watches this because he's studying Lawrence's brand of gallant showmanship. He knows he's superior; he wants to show it to everyone else. He wants to be praised. (And, in fact, there's an interview here where Fassbender talks about David's desire to be praised.
David gets his chance to swashbuckle like Peter O'Toole when Shaw is struck by the sandstorm: he leaps decisively out the side of the ship, saves Holloway, Shaw, and the head, gives them that cocky little "OK!" hand signal, and then reels them back in. His confident, eager body language shows how desperately he wants to show off. But he's not showered with praise afterward: everyone just ignores him.
David's final act before his injury also demonstrates his hunger to be praised. We don't really know what he says to the Engineer, but, like Lawrence, he suddenly bears the burden of a translator/communicator between two cultures. Finally, he's the focal point of the entire mission -- and the look of pure bliss on his face when the Engineer pats him on the head is heartbreaking, particularly since the Engineer's next act is to rip his head off. The culmination of all his work arrives, and he's not praised -- he's reduced to junk.
So: David has probably consciously recognized similarities between his life and Lawrence's. His ego develops along lines similar to Lawrence's. He then heightens the similarity even further by deliberately aping O'Toole's depiction of Lawrence. To David, Lawrence is both a mentor and a mirror.
Follow Quora on Twitter: www.twitter.com/Quora