I made use of the money entrusted on me by investing it. When the owner of the money came, I gave him his money but not the profit. Is this the right conduct?
If anyone entrusts something to you, you do not have the right to use it without his permission. You have to keep it and take care of it. If you make use of it without his permission, you have to seek his forgiveness. If he forgives you, then all well and good; otherwise you have to give him the profit made with his money, or try to reach some agreement with him to take half each, or some other agreement.