You are most likely required to fulfill the two-year home residency if:
Your J-1 program is government-funded, either by the U.S. government or your home country’s government. Government-funded programs include those sponsored by international government organizations.
Your program is focused on acquiring specialized skills or knowledge intended to benefit your home country. You can find these skills on the Department of State’s requirement list.
You are completing graduate medical education, such as a medical residency program.
Your sponsor should inform you if you must comply with the two-year rule after your program ends. It may be helpful to inquire with your immigration attorney as well.
Carefully review your visa documents for expiration dates or restrictions. Some J-1 holders may qualify for a waiver of the requirement. If the two-year rule does not apply to you, your path to applying for a green card may be more straightforward.