I am publishing a page that adds custom metadata in to Broker database and I can get all metadata information through broker API, If I unpublish that page, metadata information is still available in the broker database. Is that how publishing is supposed to work or I am missing something?
If this is component metadata, that's added through a component presentation, then you'll need to unpublish the component as well.
When you unpublish a page that has a dynamic component presentation on it, that only removes that one specific component presentation from the broker.
When you have a dynamic component template, and the component gets published, then all component presentations for that particular component go into the broker. In order to remove the metadata for the component, you need to unpublish the component.
So, try unpublishing the component as well as the page and see if that clears things up.