In the 1st pair of sentences, it would be more natural to say, "I like walking in the morning sun." But, choosing between #1 or #2, #1 is more natural; it doesn't have great wording though. Also, in most parts of the world, one cannot walk "under the sun" in the morning- it's not yet high enough in the sky to be walked under.
In your second pair of sentences, neither is correct. It should be:
1. I am tan because I always work in the sun.
2. I am tan because I always work under the sun.
And in this case, both 1 & 2 sound fine.
Why is "under the sun" ok in the 2nd pair of sentences and not the 1st pair? Because the second set of sentences is about being "tan" because of being "under the sun", so it conjures the image of someone working under the sun that is high in the sky (i.e., afternoon). Hence, it sounds more natural/logical.