When you buy a share through your broker, the order is usually matched on the NSE or the BSE. The NSE runs the Nifty 50 index through its index arm.
A company can list on both exchanges at once, so the same share often trades on each at almost the same price.