Hello. It isn't uncommon for women to develop bladder infections after having sex, presumably because sexual intercourse introduces bacteria into the urethra
(the tube that drains urine from your bladder). Bladder infections are more likely to occur if you don't urinate within an hour or two after intercourse. Inserting a tampon before you went to sleep could have played a role, too.
If your urinary burning hasn't resolved -- or if your urine still smells bad -- see your doctor. He/she can take a urine sample to see if you have a bladder infection; if that's what's going on here, a short course of antibiotics will be needed to clear things up.