If the TLB gets flushed everytime a program does a context switch, then when that program is run again, where does the TLB go to reload its table? Also, if the table gets flushed, then how are other programs prevented from writing into memory that belongs to that program?
It starts out empty and is reloaded as accesses occur.
The TLB is an optimization that avoids reading slower page table information to locate application memory; in particular, memory access control is done form the page tables, not the TLB.
And the reason you clear it is two-fold: because if you didn't, accesses from the next process might go to your process's memory (the exact opposite of your presumption!), and because it could conceivably be used to snoop on your process's memory and/or activity.