Is it possible to use xpub address to monitor balance from previously generated addresses? I'm trying to find a way where I can view balance of my ledger nano s wallet without always attaching it to computer all the time.

I found something called xpub address which allows me to generate public addresses without my hardware wallet, I am now trying to figure out if there is a way (api ideally) to use this xpub address to view balance from my previously generated addresses.
Certainly. If you use the master public key (the xpub that you have), you can enter it into a site like blockchain.info to get the balances of many of the addresses derived from that key. Generally software that do this sort of monitoring (including your wallet software), only search a few addresses (all of the ones that have been used in a transaction and then some number ahead of those) so it may miss some of your transactions.

You can also setup a desktop wallet software like Electrum to work with your Ledger Nano S. This allows you to get new addresses and monitor your balance without having the device connected and still be able to connect your Ledger to spend from it when you want to.