Are the Shimano derailleurs sold on Ali Express genuine or fake?
You pays your moneys and you takes your chance


Answer Maybe genuine, but just as likely not.

Essentially by buying discount, you're circumventing any quality and control process from the brand owner.  

Costs are a strange thing - what costs you $40 in the shop retail, might be sold on sale for 20% off and the seller isn't making a loss.  The various stages of wholesaler, importer, shipping, and so on repeatedly add a layer of costs - could be the original item costs only a small fraction of the sale price to make. 

The specific items you're looking at might be any combination of 


Quality legitimate parts, perhaps overstock or older designs that are no longer as popular.
Legitimate designs that have been built outside the brand's control, on the same production line (ie they were never official products)  This is sometimes called second shift or midnight shift product.
Legitimate items that have been rejected in some way, that have failed quality control for some reason.  Perhaps they're out of spec, or something wasn't done right in the build process
Second line product where a shadow factory makes the same item but on different machinery.  It may or may not have the same metallurgy processes as the authentic product.
Reverse-engineered product - Someone has taken a finished item and figured out how to make the same thing.  The designer would not be working from plans or specs, but from a retail product sample.
Outright fakes - where someone slaps a Brand's name on a generic component.  May have a real model number, or a completely fake model number.


How far down that hierarchy you're prepared to go is up to you, and might vary depending on the safety requirements.  I'd approximate that the more expensive are at the top and the less-expensive are lower.

Personally I have no problem with discount non-moving parts, like a reflector.  But for a wheel or brakes I'd buy original only whether new or second hand.