Is it rude not to attend courses which have no attendance requirements? I wonder how it is perceived if a student does not attend the course in which attendance is not taken.

I am a PhD student and I skipped most of class in two courses. Now, both of the instructors are mad at me. In one course the professor gave me an F on an oral exam because I could not explain one point in a chapter, after explaining the rest correctly. And the other one ignores me when I try to greet him, as opposed to 3-4 weeks ago. I feel that I have been very strictly judged, and not fairly graded by the first Professor. An F means zero points, and I am afraid the second Professor will grade his oral exam with some biases, based on the previous Professor's behavior 

Is it natural for them to behave this way? What can I do to convince people that my intentions were not to offend? I feel that most of them believe me to have a "big head" who just moved in from another country. And think that I'm a know it all. This is completely wrong; I know it is a very, very bad habit to not attend lectures. But I feel I don't need to when I've studied and understood the concepts.

To clear out some points in the comments, let me explain my train of thought. But please note that the examples given below are just some stupid examples. They do not reflect real situations and my thoughts:

1) I think it is very impolite to deliberately refuse a greeting from a colleague, especially when that colleague is on the same floor. I understand that it's a teacher-student relationship, but wouldn't you agree that it is common courtesy to greet back after being greeted? I feel that this teacher has a vendetta of sorts.

2) I'd like to give an example. Suppose that the professor is speaking English, and it's clear that they have a bad accent. When students arrive, they'd like to be able to understand the professor. Sometimes, they get mad at the professor because they can't understand them. But ultimately it's the faculty committee that they should be getting mad at. The faculty committee is the one that hires the professor. I feel that being angry at the professor is pointless. Similarly, if the university doesn't require professors to take attendance, but they want students to attend they shouldn't be angry at the students. Instead they should take it up with University Policy

3) Finally, is attending class considered a matter of respect? I don't think so. At the end of the day, the professors are there for teaching the specific subject. Students, according to university rules and policy, are not obligated to attend these classes. I feel that the professors are not doing students a favor. On one hand it's their duty, and on the other hand people have free will. I feel it's worse to attend class and not even listen.

--

After viewing your detailed answers and comments, I am fully convinced that attending classes is a matter of respect to the professor. I understand now that it is easy to be misunderstood and misjudged by not showing up to class, without any excuses. I see now that it can be easily interpreted as an act of carelessness or self-importance.

Adapting to a new culture is harder than I thought.
I think the question is not "Is it rude?" but "Do lecturers find it ok?" as the answer to the latter is not universal but varies a lot. 

Here is what I think about students skipping classes: Personally, I also do not have any attendance requirements (actually, where I am it is currently forbidden to have such requirements) for my classes and there are students who skip some or most classes. Since I do not have such requirement, I am not mad at them, but I note that they miss opportunities to get into a dialogue about the contents which help them learning the material deeper. I do get mad when these students come to office hours asking for clarifications of stuff I treated in the lecture since this basically amounts to unnecessarily teaching the stuff double. When I note that students skip many classes I get thinking "Hmm, let's see how they manage to grasp all the material…". When it comes to exams and I note that the students missed some point which has been stressed in the lectures over and over, I feel like the students really missed a crucial point (even if it is just one) just by skipping the lectures and I do not give any benefit of doubt. It's like "it was obvious that I considered this to be a central point, and you did not get it - sorry for you." However, some bright students that skipped classes managed to impress me during an exam and scored great grades.

As for not greeting students: If you haven't shown up in classes that often, your face may probably not be that familiar to the lecturer… Here in Germany we often have hundreds of students every semester so it is impossible to know the all students who are enrolled but did not show up.

As for the question What can I do to turn it around?: Show that you learned a lot by being great at exams and show that you deeply grasped the material. Do not go to office hours with questions that have likely been answered during the lectures.