Why use nested classes?
Why use nested classes in C# code?
Enable encapsulation
Many times nested classes are implementation details of the class. Users of the main class should not have to care about their existence. You should be able to change them at will without requiring the users of the main class to change their code.
Avoid name pollution
You should not add types, variables, functions, etc. in a scope unless they are appropriate in that scope. This is slighly different than encapsulation. It could be useful to expose the interface of a nested type but the proper place for the nested type is still the main class. In C++ land, iterator types are one such example.