What type of competitions?
Under USPSA, it really depends on if you want to shoot Production or Limited.
Limited has Minor/Major scoring. Long story short there, 9mm is Minor and .40 is Major. You get more points awarded for most hits on the target when shooting Major, so it's the obvious choice for most shooters. I will say that while an M&P is still mostly competitive, Limited tends to be dominated by single-action guns.
Production allows you to shoot 9mm or .40, but everything is scored Minor regardless of what you shoot. For this reason, 9mm dominates in production because it costs less to shoot and produced less recoil (meaning faster follow-ups).
One major note of concern here though, is that the number of modifications you can make to a production gun is very restrictive. Replacement barrels are allowed, but only if they are the same length and caliber as the original. As such, if you start out with a .40S&W gun, and drop in a 9mm barrel, then it can't legally be used in production division. You can shoot that gun in Limited, but since most everyone shoots Major PF in Limited anyways, you'd virtually never drop in a 9mm barrel to compete there. Basically, a conversion barrel just isn't going to do much for you there.
Steel Challenge is owned by USPSA and follows pretty much identical division rules.
I'll let someone else go over IDPA rules as I'm not familiar with them.
Regardless of which shooting sport you're looking at though, I'm sure you'll have a blast. Only thing I might say is that if you haven't already tried them and you do have some other gun (ANY other gun), you might take it out to a few matches of different types to see what sport (and divisions therein) that you like best. Once you're more familiar that will help a lot in choosing a gun.
FWIW, I currently shoot a S&W M&P 9L in USPSA Production. Sometime in the next 6 months I am likely going to be buying an EAA Witness Elite Match in .40S&W for Limited/Limited10 use (still will be using the M&P in Production as well though).