From other's conversation,I found out they mentioned I was and sometimes they also mentioned I were. Is there any rules for I was/were?
The only context where were is appropriate after I is when the sentence is in the subjunctive mood. For example:
I wish I were young. I wish I were a boy. I wish I were a policeman. I wish I were a rich man.
All the above sentences suggest you want to be something you are factually not. In other words, you are NOT young, a boy, a policeman, a rich man and you are sorry that you are not young, a boy, a policeman, a rich man.
If I were you, I wouldn't say that.
This sentence also suggests a hypothetical and impossible scenario because I can never be you.
In the old days, "I wish I was young" to express an impossible scenario was considered ungrammatical, colloquial and some people even said it sounds uneducated, but it has changed and I hear many people use "was" in place of "were". However, in some context, the meaning could be slightly different and you can visit the following links to learn more about how it works. You will notice many people have different views on this issue. The most important thing is you understand when it is used and what it means.