Megas work somewhat similarly to shinies here in Pokeheroes.
There's an undetermined chance that a pokemon that has a mega
evolution hatches "mega able," which makes it able to mega evolve.
(Mega able pokemon have a mega bubble on their profiles next to
their level and EXP and when you hover over the bubble with your
cursor it says "This pokemon appears to have a special power."
Here's an example of a mega able pokemon.)
Once you have a mega able gengar, you need to give it a mega stone
to hold and get the pokemon to level 50. Then, it will evolve to
mega gengar (consuming the mega stone in the process).