I am from Austria and can confidently talk about the situation here, but most of it will carry over to Germany, as we are culturally quite close.
As to what most people would do when hiking: for day hikes, you mostly eat cold stuff (Brotzeit/Jause: bread, sandwiches, and the like). For hikes of several days, within alpine territory, you'd usually stay in alpine huts and eat there in the evening and morning. There is an excellent system of trails and huts in the alps to allow for comfortable day sections between huts.
Considering usages of fire, there are two aspects to what is OK: the open fire itself, and the caused pollution (Geruchsbelästigung).
You can assume that open fires are forbidden, unless you have explicit permission from the owner, or there is an official public fire place. Potentially, different laws will apply for meadows, forests, Ortsgebiet (municipalities), and everything above the tree line.
The most important practical aspects here, though, are 1) traces, and 2) forest fires. Land owners don't want to see any traces of campfires, or camps at all (unless by their permission, of course). And, while not so much of a problem as in drier countries, you should avoid any dangerous things in hot summers (even so far as to avoid smoking).
There remain a couple of gray area possibilites, if you want to "do as the locals do":
Cooking on something that has no direct contact to the ground, and is not in danger of doing so, and not on dry ground, is usually OK. This mostly means: camping gas simiilar stoves on some kind of base such as stones, blank earth, snow, forestry roads, etc., and only for temporary usage -- you can cook coffee or a warm meal and then move on.
For camp fires, there are some secluded and safe places which are established. E.g., I know some places for bivouacing above the tree line with existing unofficial fire places, or some at cave entries*. Still illegal, but somewhat customary.
Respect, though, that this kind of place invites stupidity of your successors: an existing illegal fireplace in a wood near the city might be "customary", but is not automatically OK. Judge whether the place is reasonably acceptable on its own, not based on what others have done before (basically the categorical imperative of behaviour in nature).
This is not a statement of legality, though. Both activities would most likely still be forbidden, although the first one is very likely to be ignored.
This applies within municipalities and your own garden. Barbecueing on your lawn, or often even balcony, is an absolutely accepted practise, subject to Ortsüblichkeit: in a concrete municipality or housing estate, there might be rules forbidding it (especially on balconies).
It is good custom, and sometimes required by law, to use good fuel (e.g., no wet wood), and polite to inform and respect your neighbours. Sunday lunch BBQ from time to time: totally fine; one week of 24h smoking: not so much. This extends to braziers and wood fires in your own garden, although they are much less customary in cities**.
Now, with public fire places, or defined public areas where BBQ is allowed, you can in principle do all that. There is a cultural aspect playing in, though, which I'd like to warn you about. Sometimes, these places are established by well-meaning municipal governments to control otherwise illegal BBQs. These can work very well and do their job, but unfortunately, there are many cases of conflicts with locals: people complain about the new sources of smoke (and rubbish), sometimes with racist language ("the foreigners and their smelly practises!")***. I am really sorry having to say that. On the other hand (but I don't want to excuse the racism!), visitors of such places in cities sometimes really are pretty inconsiderate (loud and leaving rubbish), so again, be nice and behave reasonably.
Finally, barbecueing inside your home: with a camping gas stove, it should be no problem, as there are no extra exhausts compared to a cooking stove. Using wood or charcoal would be considered very strange (and likely dangerous, due to the gases); your landlord and neighbours would likely have something against it, and it's legally definitely not ortsüblich. (Historically, smoking inside was acceptable, but this also has pretty much changed.)
*This is one of the cases where you can see how hard this judgement is with incomplete information. Never make a fire inside a cave -- it will disturb the severly protected bats. My places are either before the cave, still on stony ground, or within short, large tunnels with large openings on both ends.
**I run a scout group in a city. We regularly make campfires in braziers, within a residential area; people sometimes complained, but we have figured out that with respect to local and (Austrian) federal law, it is OK. The ones complaining were 90% of the "old grumpy neighbour shouting at kids" type, though.
**I presume this is a class issue, actually. Poorer people, which are more likely to be immigrants, might less likely own their own BBQ equipment and especially no lawn or terrace. That, combined with more BBQ-friendly cultural backgrounds, makes for an unfortunate mix.