You can theoretically generate your own Bitcoin keys by hand, or you could write code to do it yourself. But you'd have to be kind of nuts to do that, IMO.
You can generate a "mnemonic seedphrase", which is essentially a big random number used to generate Bitcoin keys, using dice rolls or coin flips and a piece of paper. You would still want to use some existing software to get keys from that mnemonic phrase. However, you can use what's called an "offline signing device", where your keys stay permanently off any internet connected device.
Buying depends entirely on where you are. Can be very easy (like in most Western countries), or very difficult (if you are in Nigeria, for example).