There's an Information Technology Act that deals with cybercrimes and electronic commerce. There are different sections under it for different types of cybercrimes done by hackers. The section that is applicable in your case is Section 66 (2) of the IT Act.
According to Section 66(2) of the Information Technology Act, 2002-
"Whoever commits hacking shall be punished with imprisonment of 3 years or with fine which may extend to two lakh rupees or with both."
So, yes it is illegal to interfere with the personal information of others without their knowledge. Even if you were only curious to see if the account of your friend is accessible with your knowledge of their id and a guessed password, once the account is accessed by you, without the knowledge of your friend, no matter how close the person is, you have done something that is illegal in the eyes of law.
If you have opened or read any of the personal or confidential information then you have breached your friend's privacy and it also results in cybercrime even if you didn't use the information anywhere for good or bad purposes.
Also, remember that there are enough ways to know who opened whose account so if anything wrong happens, the hacker can easily be identified and sent to jail. So, don't get curious about the personal information of others. Such curiosity often results in crimes.
Maybe your friend won't complain but remember to not repeat this incident ever again.
Make love to life before it divorces you.