You have been discharged with an indwelling urinary catheter. It's also called a Foley catheter. A catheter is a thin, flexible tube. An indwelling urinary catheter has two parts. The first part is a tube that drains urine from your bladder. The second part is a bag or other device that collects the urine.
The most important thing to remember is that you want to prevent infection. Always wash your hands before handling your catheter bag or tubing.