how to change card background color in bootstrap

First of all - you used card instead of .card selector. If you want to set your own background-color for .card you should remove .bg-primary class and set rules for .card:

.card {
    ...
    background-color: rgba(0, 0, 0, 0.2);
    ...
}

Second - in bootrstrap 4 background-color of .bg-primary is declared with !important, so it overrides any other declarations:

.bg-primary {
    background-color: #007bff!important;
}

You can either add your own class to .card:

.bg-custom-1 {
    background-color: rgba(0, 0, 0, 0.2);
}

Or you can set your color for .bg-primary if you still want to use it (make sure that your css goes after bootstrap css):

.bg-primary {
    background-color: rgba(0, 0, 0, 0.2)!important;
}