I'm wondering if there're any rules concerning transgender people in
chess.
I asked this question or something very like it of someone who was in a position to know. Basically if your sex is recorded by FIDE as "M" and you tell them it has changed to "F" (actually your federation has to tell FIDE. Not you since FIDE trust the federations who they know rather than the players who they generally don't know) then FIDE will change your records to reflect this fact. Similarly if you choose to go in the opposite direction. I should add that I asked this question in a spirit of intellectual curiosity rather than personal interest :-).
If Carlsen (as of time of writing the [male] World Chess Champion)
decides to sex change, are there rules that bar him (her?) from
competing in Women-only competitions?
First you should know that there is no such thing as "male" World Champion. Carlsen is world champion, period. If one of the top women players qualifies to play him (or another person) for the title of "World Champion" and wins then that woman would become World Champion.
If Carlsen decides to change sex then she would, of course, be eligible to play in Women-only competitions.
If Carlsen decides to sex change, does he instantly become the Women's
World Chess Champion?
Your question is grammatically wrong. It should read "does she instantly become the Women's World Chess Champion?"
The answer is, of course, "obviously not". There is a cycle of tournaments which anybody wanting to become Women's World Chess Champion must compete in and succeed in to become Women's World Chess Champion. Carlsen would have to do this first.
If Carlsen decides to sex change, does he instantly acquire the WGM
title?
Again the grammatical error in the question. It should be "If Carlsen decides to sex change, does she instantly acquire the WGM title?"
Certainly not! She would have to apply for the title. FIDE would have to decide if norms achieved while a man qualify for women's titles. I would suspect not which would mean that she would have to achieve the norms required as a woman.
I would add one further point. In general titles cost money. FIDE charges you if you want a title and have qualified for it. In your hypothetical situation if Carlsen wanted even the WFM title, even the WCM title, then she would have to apply and pay for the title.
I know the new regime under Dvorkovitch has talked about charging players and officials (arbiters and organizers) less and getting more money from sponsorship but I don't think this rhetoric has been changed into action yet.