Considering that ~95% of all my major characters are girls, I do this all the time. There's a very simple way to write characters that are different from you.
Know other types of people
Most of my friends are white, teenaged girls. Knowing other types of people will help you learn many things about them, the first and most important things is this.
The description of white, teenaged girls means next to nothing. They're all individuals and very different from one another. The fact that they're all teenaged girls seems to only mean that they like the internet.
At the end of the day, we're all just people
You may notice that I didn't use opposite gender. For one thing it implies that males and females are like night and day and it also implies that there are only two genders. There's many different genders (genderfluid, nonbinary, intersex) you may have heard of these terms, if you haven't you should look them up.
If you think it's weird. Don't. The mantra of the day is that we're all just people.
What does it mean to have a different gender? Really it doesn't mean much at all. The thing you should know is the roles that society expects everyone to fit in and whether or not your character embraces or rejects these ideals.
I'm skipping the section for race and sexuality, because that is basically the same as gender. The real difference amongst groups of human beings comes from culture.
People will not inherently be a certain way because of their culture, but a culture will have a large impact on how a person is.
Here are some tips on making characters from a different culture.
1. Don't assume you know the culture. Just looking it up will usually be enough, but nothing beats actually experiencing the culture firsthand.
2. Being from a different culture is not a personality trait.
3. Don't use stereotypes. Even though some have basis in reality, many also do not. Even if they DO have basis in reality, they're exaggerated to unrealistic proportions.
4. Many countries speak the same language, such as England and America. Not only do they speak different styles of English (though it's mostly similar) they are quite different cultures.
5. There are many different types of cultures within one country, and even within communities.
In general, the best way to make people is to simply make a person. Think about how being the same as others and different from others effects them and influences their behavior.
Any questions or comments? Leave one below or email me at email@example.com