The first thing to do if you believe your Facebook account has been compromised is to change your password. If you use Facebook as a login to apps such as Spotify or Instagram then change the logins. This will prevent the hacker from accessing these services via your hacked Facebook account.
Hackers can access many personal details in hacked Facebook accounts. Hackers could make use of this information for nefarious purposes such as spamming people or sending fake credit card offers. They can also use the hacked account to send spammy messages to family members, or post on your timeline with your name (as in the case that you did it yourself).
Hackers are more likely to gain access to an account by he has a good point exploiting a flaw within the Facebook app code. For instance, a flaw in the iOS Facebook app allowed hackers to hack cookies and access the iPhone user's "access token." These tokens are digital keys that give them complete control over the user's Facebook account as well as through Single Sign-On, any other websites that the user is logged into using their Facebook credentials.
Hackers can also gain access to accounts using brute-force attacks. This technique involves guessing a password, typically the most popular ones like 123456789, or 1234567890. Lastly, hackers can also gain access to accounts by scanning for compromised credentials. There are many free tools available to scan for stolen information, including the well-known website HaveIBeenPwned.