Where does angular momentum come from when an object gets attracted by a planet? Consider an object effectively travelling in free space, maybe expelled from another solar system a long time ago.
The object enters our solar system and approaches say Jupiter.
Obviously while freely moving the object has linear momentum and seemingly no orbital angular momentum. (Also assume that it initially isn't rotating so that it initially doesn't have spin angular momentum).  I would like to know what happens to the energy in 2 general cases.
Firstly, the object enters orbit around Jupiter. It now seems to have orbital angular momentum and maybe potential energy as well? But no linear momentum? Is this all correct? And what did the gravitational field do to cause the changes in energy?
Secondly, the object doesn't enter orbit but is partially deflected. As it moves in a curve for a short time does it have orbital angular momentum at that time which it then loses (or possibly keeps by gaining by rotation, i.e. spin angular momentum).
 A: Just because an object is moving in a straight line doesn't mean it has no angular momentum. Recall that angular momentum is defined by $$\vec L = \vec r \times \vec p$$ As long as $\vec r$, the vector from the point about which angular momentum is being calculated to the object is non-zero, an object moving in a straight line will have some angular momentum.
An object falling into the solar system does not suddenly enter an orbit at one point and exit at another, if gravity is the only force acting on it. Rather, it stays on one orbit the whole time. This may seem confusing, as the term orbit is traditionally used to specifically refer to elliptical trajectories, but for an object coming from outside the solar system, the object will most likely be in a hyperbolic orbit.
Nonrelativistically, linear momentum is defined by $$\vec p = m\vec v$$ so since the object will still be moving as it goes around Jupiter, it will still have linear momentum. The total mechanical energy (kinetic plus potential) will be conserved along any orbit.
Because gravity acts parallel in the direction toward the centre of mass of Jupiter, the torque about Jupiter's centre of mass will always be zero, so the angular momentum about Jupiter's centre of mass will remain constant (neglecting the effects of the other planets).
A: 
Obviously while freely moving the object has...seemingly no angular momentum (isn't rotating)

Here is one error. If you pick a point along the straight line path of the object, then the angular momentum of the object is $0$. But if you pick your reference point as, say Jupiter itself, then there is a non-zero angular momentum about this reference point (assuming the object isn't heading right towards jupiter.
This is because the definition of angular momentum is $$\mathbf L=\mathbf r\times\mathbf p$$
Since in the case of using Jupiter as the reference point $\mathbf r\times\mathbf p\neq0$ (these vectors do not point in the same direction), we have a non-zero angular momentum. Furthermore, before having substantial influence from Jupiter, this angular momentum is constant because no net torque acts on our object.

Firstly object enters orbit around Jupiter. It now seems to have angular momentum and maybe potential energy as well? But no linear momentum? Is this all correct and what did the gravitational field do to cause the changes in energy?

The object keeps the angular momentum it had when coming into the orbit.$^*$ The object still has a non-zero velocity, so it still has linear momentum, as $\mathbf p=m\mathbf v$. The gravitational field does work on the object. Since gravity it conservative, we can easily consider the energy in terms of gravitational potential energy. As the gravitational potential energy of the object decreases, its kinetic energy (speed) will increase. If gravity is the only force acting on our object, total mechanical energy will be conserved the entire time.
It seems like you are thinking "Moving in a straight line $\to$ linear momentum. Moving around a curved path $\to$ angular momentum." This is not the case, as the above shows.

Secondly the object doesn't enter orbit but is partially deflected. As it moves in a curve for a short time does it have angular momentum at that time which it then loses (or possibly keeps by gaining rotation).

Since gravity is a central force, if this is the only force, and if your reference point is the center of this force, then there is no net torque acting on the object. Hence it's angular momentum will be conserved.

$^*$If the object "came from infinity" then this will be a hyperbolic orbit, not an elliptical one around Juptier. Unless there is something taking energy from the object
