TL;DR Software is instruction. Hardware is the physical material that takes instructions.
What is software and what is hardware? Here is a basic non-formal definition for myself:
Hardware are the physical devices in the physical world. They are atoms arranged in a way that achieve certain functionalities.
Software are instructions that make use of the hardware. Instructions can be assembled with logic/math/ideas/algorithm.
A metaphor: I use my fingers to turn on and off a light bulb. That's my two instructions—on or off. The light bulb brings some changes in this world which matches their intention/function—light or dark. The physical device, now CPU, is the one that take instructions and performs some actions through its IO. That's the whole story.
Hardware exposes the possibility and software makes a choice for it. That direct/indirect choice originates from the human mind.
Remember that any thing in the physical world is the their senses combined with ideas. This general/abstract term “Hardware” does no exist in the physical world but any concrete one should. They are supposed to work following our understanding of their machinery. We don't check every bit of detail but if we want, we should be able to.
When we say something is hardcoded, we usually mean that those instructions are not changeable in the device because they are part of the device. The device does not allow changing them, usually because there is no point in changing them to serve the intended purpose of the device.
There could be disconnect between the instructions we give and the ultimate function they can achieve, e.g. in the world of AI and training, we don't fully understand every detail how they did it but we gave the instructions to make them do it, the outcome is a result of our instructions but we are lost in the middle, at least for now.