I drew a bezier curve and tried to applied curve modifier to a long cylinder with this bezier curve. I noticed that the generated cylinder has self-penetration on its cross sections. How to avoid this? And how to align the cylinder with the curve? The curve has an origin outside the curve. I don't think it is hard to edit the origin point of the curve. Any hints are appreciated. Thank you.
You probably have reversed handles on control points.
Select the Bezier Curve and enable Curve Edit Mode normals in the Overlays drop down:
set the length to something large and edit the curve.
If the curve handles aren't backwards, it will look like this more or less
But if they're backwards, then it will look like this
If they are reversed, then your cylinder will have kinks in the same places
To fix the curve, select the control point that has the reversed normals and rotate the handle until they point the right way.
You'll have to do this for every screwed up control handle. It looks like you have two.