A group is started, then
\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname ProvidesPackage\endcsname\relax\else
\ProvidesPackage{ifxetex}
[2010/09/12 v0.6 Provides ifxetex conditional]
\fi
remains. Now the first \expandafter is expanded, which causes the third to act, which expands the fourth and finally \csname ProvidesPackage\endcsname forms the \ProvidesPackage token, making it equivalent to \relax if not defined.
Now we're left with
\expandafter\endgroup
\ifx\ProvidesPackage\relax\else
\ProvidesPackage{ifxetex}
[2010/09/12 v0.6 Provides ifxetex conditional]
\fi
The remaining \expandafter expands \ifx. If \ProvidesPackage had no previous definition, the test returns true and
\endgroup\else\ProvidesPackage{ifxetex}[2010/09/12 v0.6 Provides ifxetex conditional]\fi
remains. The group is closed, undoing the assignment of a meaning to \ProvidesPackage. Then \else is expanded, which means that TeX skips all tokens up to the matching \fi which eventually disappears.
If there was a previous definition for \ProvidesPackage existed, TeX skips all tokens up to and including \else, so we remain with
\endgroup\ProvidesPackage{ifxetex}[2010/09/12 v0.6 Provides ifxetex conditional]\fi
The group is closed and \ProvidesPackage is executed (with the necessary expansion steps). The trailing \fi has null expansion.
The moral is that if \ProvidesPackage was not defined when the code is found, it won't be at the end of the process.
Without the \begingroup\expandafter\expandafter\expandafter\endgroup trickery, the code would end up with \ProvidesPackage being equivalent to \relax, if not defined previously.