As Nike mentioned, most basis sets produce more orbitals than the minimal set that you tend to think of for these elements. We can see how this works out for 6-31G(d,p) by looking at how the basis set is defined:
H 0
S 3 1.00
0.1873113696D+02 0.3349460434D-01
0.2825394365D+01 0.2347269535D+00
0.6401216923D+00 0.8137573261D+00
S 1 1.00
0.1612777588D+00 1.0000000
P 1 1.00
0.1100000000D+01 1.0000000
****
C 0
S 6 1.00
0.3047524880D+04 0.1834737132D-02
0.4573695180D+03 0.1403732281D-01
0.1039486850D+03 0.6884262226D-01
0.2921015530D+02 0.2321844432D+00
0.9286662960D+01 0.4679413484D+00
0.3163926960D+01 0.3623119853D+00
SP 3 1.00
0.7868272350D+01 -0.1193324198D+00 0.6899906659D-01
0.1881288540D+01 -0.1608541517D+00 0.3164239610D+00
0.5442492580D+00 0.1143456438D+01 0.7443082909D+00
SP 1 1.00
0.1687144782D+00 0.1000000000D+01 0.1000000000D+01
D 1 1.00
0.8000000000D+00 1.0000000
****
So for $\ce{H}$, we get 3 different types of orbitals: an S orbital formed from 3 primitive Gaussians, an S orbital formed from 1 primitive, and 3 P orbitals formed from 1 primitive. For C, we have an S orbital formed from 6 primitives (meant to represent the core S orbital), 2 sets of SP orbitals (meant to represent the valence S and P orbitals), and 6 D orbitals formed from 1 primitive.
The P orbital for $\ce{H}$ and D orbital for $\ce{C}$ (these are the (d,p) in 6-31g(d,p)) are referred to as polarization functions. These are higher angular functions added to the basis to allow for a more flexible description of the electron density, especially directional interactions like bonds.
As for why there are 6 D orbitals rather than 5, this is because the Pople basis (the ones written X-YZ...G) use Cartesian functions rather than spherical ones. In the Cartesian representation, it takes 6 functions to represent the D orbitals. This discrepancy between the number of Cartesian and spherical functions continues for higher angular momentum functions as well (e.g. there are 10 Cartesian F functions, rather than the typically seen 7 spherical ones).
However, as Susi noted in the comments, the Pople basis sets actually use spherical functions for F orbitals; this can be confusing to handle. Among many other reasons, this is why the Pople basis sets are mainly just of historical significance and that other, more modern basis sets should be used.