The inclusive decay B --> X_u l nu is of much interest because of its potential to constrain the CKM element |V_ub|. Experimental cuts required to suppress charm background restrict measurements of this decay to the shape-function region, where the hadronic final state carries a large energy but only a moderate invariant mass. In this kinematic region, the differential decay distributions satisfy a factorization formula of the form $H cdot J otimes S$, where S is the non-perturbative shape function, and the object $H cdot J$ is a perturbatively calculable hard-scattering kernel. In this paper we present the calculation of the hard function H at next-to-next-to-leading order (NNLO) in perturbation theory. Combined with the known NNLO result for the jet function J, this completes the perturbative part of the NNLO calculation for this process.