Disclaimer: Playing Cosmic Encounter with less than 4 players is never going to be the same or as good a game as with 4-6 IMHO. However, the following set of simple rules is a reasonable way to play, particularly for teaching purposes, if 2 is all you can get.
2 Player Options if you are dead set on playing Cosmic:
1) Get more players - this would be best but isn't always possible.
2) Play the 2 player variant in More Cosmic Encounter - I have only played
this variant once but found it rather unsatisfying. In addition, I would
definitely not recommend it for teaching a new player as a lot of the
rules are very different from the normal game and it will thus not be a good
introduction to the regular game.
3) Try this variant. I have played it about 3 times and it worked pretty
well. The particularly nice thing about it is that it very closely follows
the standard rules (really only 2 rule changes) so it is an excellent
teaching environment.
2) The primary difference in this variant is that each player controls two systems/colors, artificially creating a four player game. Each of these systems/colors is 100% independent with its own power(s), hand, destiny color, moons (if used), lucre (if used), etc... The player who owns each system/color can at any time look at anything associated with that system but may never, except following normal rules (such as Philanthropist) transfer any material from one system to the other.
3) The win condition is the standard one. If either of a given player's systems/colors establishes 5 external bases, that system/color's owning player wins.
4) I recommend that you physically place a given player's two systems next to one another but turn order should alternate between the two players. Consider the following example with Player 1 (P1) controlling the Red and Orange systems and Player 2 (P2) controlling the Purple and Yellow systems.
____ ____ / \ / \ / \ / \ | RED | | PURPLE | | P1 | | P2 | \ / \ / \____/ \____/ ____ / \ / \ | WARP | | P1 | \ / \____/ ____ ____ / \ / \ / \ / \ | ORANGE | | YELLOW | | P1 | | P2 | \ / \ / \____/ \____/Randomly select which color goes first. The diagonally opposite color goes next followed by the color horizontally opposite the second player followed by the remaining player who would diagonally opposite the third player and then back to the starting player.
5) Major Rule Change: A given player may never end up
challenging himself and should never end up in a deal situation
with himself. To facilitate this, the following rule changes:
A) If a player's destiny flip forces him to attack his other color, he
must flip again.
B) If a player flips his other color and moons are in the game, he may attack
a moon (assuming it is not occupied by his other color) or may flip again.
Note that (particularly if you are not playing with moons) I recommend
these reflips are treated as if they never happened for purposes of
powers such as Assassin and Disease.
C) If by some chance a player ends up in a deal situation with himself, he
is not allowed to deal and both colors lose 3 tokens to the Warp. However,
this should never be allowed to happen (see below).
D) Items which seem likely to lead to violations of this rule should be
removed from the game (see #6 below).
6) I recommend not using the following Powers in this variant. Note
that I generally play Eon rules and don't offhand remember all the Mayfair
powers - most of this is common sense anyway. If you get one of these
powers, randomly draw a new one to replace it.
Too Powerful: Magnet, Silencer1
Will likely lead to violations of Rule 5: Demon, Diplomat, Dictator,
Delegator
7) In order to avoid someone getting a bad hand and just being stuck with it, you may wish to use the Punt Option. This option would allow any player to skip the entire turn for one of his colors in order to discard that color's hand and get a new one. This is entirely an optional suggestion.
8) That's it. Enjoy. Let me know if you have questions/suggestions.
Footnotes
1) If you do use Silencer, the power would silence the color, not the
player.