A QR code, like any other barcode, simply contains some encoded text - up to 4,000 characters. There are some standard text formats that are instructions to the phone to do something. For example, if the QR code contained:
WIFI:S:guestnetwork;P:p@ssw0rd
your phone would interpret that as telling it to join the wifi network "guestnetwork" using the password "p@ssw0rd". Similarly, there are standard ways for a barcode to tell a phone to go to a website or download an app.
If a holiday camp, for example, builds an app to allow you to order things from a menu, they could put a QR code by each item containing, say, a description of the item and its cost along with something that makes it clear it is one of their barcodes - something like:
"holidayapp"{"item":"beans on toast","cost":"5.00"}
This would tell the app that this is one of its QR codes (holidayapp) and that the customer wanted to order beans on toast at a cost of £5.
If the app scanned any QR code that wasn't for it (e.g. the QR code above), it would ignore it as it didn't contain the "holidayapp" tag. Because the app was scanning the QR code, the phone won't do anything with it either - the phone will only react to QR codes scanned with the camera app or with a special QR code reader.
There are apps available that will scan any barcode and show you the text it contains.