Both mean How are you? Ihnen is formal and dir is informal.
In German speaking countries, work colleagues normally address each other and their customers in a formal way using the Ihnen form of you, even if they have known each other for some time.
The dir form is used when talking to children (up to about 14), and amongst friends and relatives.