I have a mapping with 0 to 10. I have values stored in this mapping. If I want to get the information stored on map<5> it gives me the details. Is it possible to get the transaction id and block in which this information is stored using either ink or polkadot-js
Not directly. If you want to know in which block the storage changed you would have to scan the Blockchain to try to find the extrinsic that make this storage change. You can do that using for example the Subscan API to query the events and filtering with the event your pallet emits after store the data in your storage or if you are not emitting events just querying the extrinsics.
But is more efficient to store the Transaction Hash that you get after the
signAndSend function in PolkadotJS, or event better the unique identifier of the transaction (see the explanation in this StackExchange old question) which is the
block# + the extrinsic index in that block (See this old response on StackExchange to see how to get it using PolkadotJS).