Yes, it's pretty safe. In a lot of ways, your bank account routing number and account number are unlike a credit card account number in that they're not, like, secrets that can be combined with a little other information to take your money whenever they want. All bank routing numbers are publicly listed (individuals can use the ABA's website to look one up). As far as your account number, each bank has a different practice, or lots of practices at once—often inherited from the other banks they acquired or merged with to form their current selves—but many do just count up by "1" for each new account at a given branch, for example. And yes, as others pointed out, they print both on the bottom of your checks, and you hand those to other people! To keep! And they can even download a scanned image of the check later if they want. Not only that, your payees often write their own account number on the back of your check when they endorse it, which you can see in the scanned image in your online banking.
Checks are a little relevant because as far as electronic payments via ACH go—they evolved from figuring out faster ways to clear checks—it's like a lot of the US financial system, in that everything boils down to mutual trust, especially huge economic and direct financial incentives not to spoil the trust of the public in a currently-trusted system.
How does it actually work? There are many players and bank associations involved, so this is an oversimplification, but essentially, banks gather a list of electronic credits and debits throughout the business day, and submit them up the chain—sometimes to a larger bank's ACH clearing desk, sometimes directly to the operators of a central clearing service, the ACH network. In the United States, there are two operators—one is a subsidiary of the Fed (the Federal Reserve System, the central bank of the United States) called FedACH; the other is private, but owned by several of the major US banks via a sequence of nesting-doll subsidiary corporations. That one is called EPN, the Electronic Payments Network. The rules for how all of this works on a day-to-day technical level, and also on a regulatory level to maintain the trust, are maintained by a somewhat separate oversight organization, Nacha. (A super-necessary and fun rebrand from their previous name, NACHA, which stood for the National Automated Clearinghouse Association.)
The functional system of mutual trust comes from the way banking power at the large institutions at the top (the federal government, and its central bank, and the equally-powerful folks running the largest US banks) devolves to the middle layers downwards, and eventually all the way to the smallest banks initiating ACH credits/debits every day for their retail customers. It's just like the layers of trust that keep most of us sure that those green pieces of paper in our wallets are a steady store of value. Each layer has an incentive from above to ensure their part of the system feels safe and works well enough that the layer beneath (their customers) will use it. In your case, both your checking account and that credit card are issued by banks in business with each other to operate the ACH system, which they both directly benefit from (revenue: they charge fees for access to the system; operations: they need a way to send money to each other either way). They probably also are partners in lots of other mutually-beneficial business lines to make money together. Simply put, the big credit card company has too many disincentives to ever try and defraud the big bank in such a blatant manner. It'd also be super illegal, of course. :)