Both sentences are correct, but there are subtle differences in usage:
"It's my cousin."
This is more common in casual conversation. "It" is often used to refer to people in a general or impersonal way, especially when the focus is on identifying someone.
Example: When pointing out someone and quickly identifying them, you'd naturally say, "It's my cousin."
"He is my cousin."
This is slightly more specific because "he" directly refers to the person’s gender. This sentence may be used when you're clarifying or when you've already established who you're talking about.
Example: If someone asked, "Who is that guy over there?" you'd answer, "He is my cousin."
In general, "It's my cousin" is more common when identifying someone on the spot, while "He is my cousin" is used when the context of the conversation is already focused on that person.