I have a Canon EOS Rebel T5.How can I achieve this with using flash? anytime i take pictures with flash the background also gets brighter. I really want to put emphasis on the subject and have a dark/black background. thanks in advance
This is simple: more distance. Light falls off with the square of the distance from the flash, so it doesn't need to be a huge, but the basic idea is to get the background far enough away that the flash doesn't light it effectively.
If you are distance-constrained, you can use an external flash to the side and "flag" it — that is, block some of the light with a piece of cloth or cardboard or similar — so less is directed towards the background. That'll buy you a little more space, but since light bounces around, you still need some room.
You'll also need to make sure your flash is the primary source of light — you'll want to use the camera's flash sync speed and probably use a narrower aperture and more powerful flash, so that the room lighting is irrelevant.