To make money through trading, you need to buy something on black market somewhere, and sell it on black market somewhere where that something is in demand.
The best candidates for selling are certain pirate or luddic planets, because they tend to have supply problems (if someone intercepts their trading fleets, that actually causes a shortage and increases prices of certain goods). For example, Umbra or Qaras often have a shortage of supplies, drugs, organs, and fuel (because every faction is attacking their trading fleets). Chalcedon constantly has a shortage of marines in addition to that as well.
When you approach such systems, they will frequently spam procurement missions for the goods they are missing. Those let you offload things like organs or heavy armaments at prices like $1000 or more, while they cost $200-500 to buy elsewhere. You can go there with a full cargo of such goods, sell some on black market and give some to the quest NPCs for a massive profit.
You can fly around, buying these goods wherever you can, and store them at various abandoned stations until there are missions that require them (there are such stations in Mayasura, Corvus and other places).
You can also cause shortages yourself. If you see a pirate fleet heading to, say, Qaras, and you destroy it, you will be able to sell a bunch of stuff to Qaras for a massive profit for a while. You have to do that in hyperspace, because if you fight their ships in front of their planet they will not let you trade for a month or two. You can also raid planets for the same effect, as others have mentioned, but that's rather exploity.
All of this regularly changes with patches. It massively changed from previous game version, and will probably change in the upcoming version as well.