I looked up the phrase "how do you do?" because it has been a while since I have heard it used and it did not make much sense to me when I thought about it. It is from a website called "phrase finders".
How do you do
This greeting was once commonplace, especially amongst the English upper classes, but is now heard less often and is largely rectricted to quite formal occasions. The phrase became one of the touchstones in the separation of the U from the non-U, that is, the separation of the upper classes from the rest. The U contingent had napkins, lavatories and greeted people with 'how do you do'; the non-U had serviettes, toilets and greeted with 'hello'. The proper response to 'How do you do?' was a reciprocal 'How do you do?', as in this exchange from Oscar Wilde's Lady Windermere's Fan, 1892:
Lord Darlington: How do you do, Lady Windermere?
Lady Windermere: How do you do, Lord Darlington?
'How do you do' has its essence in the early meaning of the verb 'do', which has been used since the 14th century to mean 'prosper; thrive'. Even now, gardeners sometimes refer to a plant that grows well as 'a good doer'. The association with 'do' as specifically relating to one's health is first found in print in The Paston Letters, 1463: