If the animal was assessed as a candidate I would release it into the wild. If it was not I would either loan, lease, or barter it to a sanctuary or similar organization for a trinket like a pen or a penny a century. You cannot sell the elephant. A lease or loan are not a sale and by definition an exchange of direct goods is an exchange- not a sale. You do not pay sales tax on trades, you may need to pay gains taxes, it is legally and by definition- not a sale. Loans and leases are also not giving it away. With loans and leases you do not transfer ownership. The same is true if you set it free. You technically still own it but it is free. A trade is not giving it away because you received something in exchange.
You could also probably do something with trusts and living wills or grants to avoid the stipulations but effectively release interest.
Also- most countries are similar but speaking for the USA- if someone “gives you an elephant” the affair is almost certainly illegal
Any contract that is inherently illegal to enforce- such as one requiring illegal deeds in commission of the terms, can be nullified- or the parts resulting in or stemming from illegality can be. Thusly if it were a contract of sorts and not some mystical hypothetical- it would likely be easy enough to nullify the terms and either have the elephant but be free to act as you choose, or not have to take possession of the elephant. Of course a contract cannot be unilaterally imposed in the USA between private parties. I would caution in many countries that you wouldn’t have to give away or sell the elephant to avoid its care, moSt countries would sieve the elephant if you didn’t have the permits and facilities or resources for its care. Seizure however could result in penalties such as fines or censure etc. so best probably for most people and the elephant to rehome it as quickly and ethically as possible.
After I take the giraffe out of course
You could also probably do something with trusts and living wills or grants to avoid the stipulations but effectively release interest.
Also- most countries are similar but speaking for the USA- if someone “gives you an elephant” the affair is almost certainly illegal