To add a passcode, go to Settings > Privacy and Security > Passcode Lock. You can set the app to automatically lock after a certain amount of time, and can manually lock the app by tapping the 🔓 icon in your chat list.
If supported by your device, you can also enable fingerprint or face unlock, in addition to the numerical code. For extra security, you can also enable a Two-Step Verification Password – which is required each time you log in to your Telegram account.