??? Types are assigned to the following:
Eggs - They are given this type because they're end type is unknown
Curse - Is a move which changes affect if used by a ghost type, therefore assigned a ??? type
Weather Ball - Type changes depending on the weather in play
Arceus - Originally Arceus was coded with this ??? type so that it could change type when presented with a plate. This was changed as the amount of hackers who hacked this ??? type would crash their game. Arceus was then reverted to Normal type to prevent hacking and crashing.
Here is what Bulbapedia has to say on the matter:
Arceus has the Ability Multitype, which changes its type and appearance depending on the Plate it is holding. Likely as a precaution for Arceus hacked to be ???-type, a ???-type sprite of Arceus is present in Diamond, Pearl, Platinum, HeartGold, and SoulSilver Versions; however, it is never used without hacking. It is also likely that this ???-type Arceus was made so that Arceus wouldn't crash the game whenever it tried using Multitype to change its type, though this is probably not the case due to the lack of a ???-type Kecleon.
Link to Bulbapedia
This also explains why all flying types (except one and those changed by abilities etc.) have duo types. It used to be when a Flying type used roost they would become ??? type. With a secondary type they now become that secondary type.
This ??? type was retired for Gen V games and is not used in coding any longer.