Due to lack of definition, you are with the term
Hobbywerkstatt
in a building law gray area. And depending on the brightness setting the caseworker has made on their monitor, the gray appears lighter or darker.
Building law distinguishes between planning law (Building Code) and building regulations law. Since planning law is plot-related, the relevant aspects of your question cannot generally be answered. A specific plot must be known for that. The workshop in the basement is likely unproblematic in terms of both planning and building regulations law.
An "annex house" is probably not a structurally correct term.
From a planning law perspective, it is an ancillary structure according to §14 Land Use Ordinance. From a building regulations law perspective, according to Art.2, paragraph 2, BayBO, a building.
In Bavaria, to my knowledge, garages up to a maximum of 50 sqm do not require building permission.
Correct.
Furthermore, they may be built up to the property boundary with a maximum wall length of 9 m. Is this correct?
Correct, provided the other conditions of Art. 6, paragraph 9 are also met.
However, one is not allowed to build a second one of the same size; if you build two, then the 50 sqm and 9 m apply to both together.
I cannot confirm this sentence because it presupposes many unspecified conditions.
What else may one build directly on the property boundary?
Art. 6, paragraph 9
covered underground garage driveways, elevators to underground garages and buildings without living spaces and fireplaces with an average wall height up to 3m ...
What else would not require a permit?
Art. 57 BayBO
Is a garage allowed to be used as a workshop if you were to build a second one?
That depends... A border garage is not allowed, unless you manage to convince the building authority that the workshop is not a living space. But I consider that hopeless.
whether a shipping container would require a permit
That depends... Planning law, dimensions
Without a development plan, in town, 40-foot container => No; development plan outside building area => Yes, outer area => Yes; 40-foot High Cube => Yes
how close it may be to the property boundary
That depends... Planning law, dimensions, use
Without development plan, 40-foot container, storage room => 0 m; Without development plan, 40-foot container, workshop => 3 m; development plan closed construction, 40-foot container, workshop => 0 m ...
But what is allowed and where could there be trouble?
If a container is permanently installed, it is subject to the same regulations as a solid building.